mirror of
https://github.com/abhijithvijayan/web-extension-starter.git
synced 2025-10-07 07:22:37 +02:00
dynamically generate version field for manifest.json from package.json
This commit is contained in:
parent
dd18c91b21
commit
3fc3d01d17
@ -1,7 +1,5 @@
|
||||
{
|
||||
"manifest_version": 2,
|
||||
"name": "Sample WebExtension",
|
||||
"version": "0.0.1",
|
||||
"author": "abhijithvijayan",
|
||||
"short_name": "Sample Name",
|
||||
"description": "Sample description",
|
||||
@ -10,6 +8,7 @@
|
||||
"persistent": false,
|
||||
"scripts": ["js/background.js"]
|
||||
},
|
||||
"manifest_version": 2,
|
||||
"minimum_chrome_version": "49",
|
||||
"permissions": ["tabs", "storage", "http://*/*", "https://*/*"],
|
||||
"content_security_policy": "script-src 'self' 'unsafe-eval'; object-src 'self'",
|
||||
|
||||
@ -1,7 +1,5 @@
|
||||
{
|
||||
"manifest_version": 2,
|
||||
"name": "Sample WebExtension",
|
||||
"version": "0.0.1",
|
||||
"author": "abhijithvijayan",
|
||||
"short_name": "Sample Name",
|
||||
"description": "Sample description",
|
||||
@ -9,6 +7,7 @@
|
||||
"background": {
|
||||
"scripts": ["js/background.js"]
|
||||
},
|
||||
"manifest_version": 2,
|
||||
"permissions": ["tabs", "storage", "http://*/*", "https://*/*"],
|
||||
"content_security_policy": "script-src 'self' 'unsafe-eval'; object-src 'self'",
|
||||
"icons": {
|
||||
|
||||
@ -1,7 +1,5 @@
|
||||
{
|
||||
"manifest_version": 2,
|
||||
"name": "Sample WebExtension",
|
||||
"version": "0.0.1",
|
||||
"developer": {
|
||||
"name": "abhijithvijayan"
|
||||
},
|
||||
@ -12,6 +10,7 @@
|
||||
"persistent": false,
|
||||
"scripts": ["js/background.js"]
|
||||
},
|
||||
"manifest_version": 2,
|
||||
"minimum_opera_version": "36",
|
||||
"permissions": ["tabs", "storage", "http://*/*", "https://*/*"],
|
||||
"content_security_policy": "script-src 'self' 'unsafe-eval'; object-src 'self'",
|
||||
|
||||
@ -35,7 +35,20 @@ module.exports = {
|
||||
}),
|
||||
new CopyWebpackPlugin([
|
||||
{ from: 'src/assets', to: 'assets' },
|
||||
{ from: `src/manifests/${process.env.TARGET}.json`, to: 'manifest.json' },
|
||||
{
|
||||
from: `src/manifests/${process.env.TARGET}.json`,
|
||||
// expose and write the allowed env vars on the compiled bundle
|
||||
transform(content, path) {
|
||||
// generates the manifest file using the package.json informations
|
||||
return Buffer.from(
|
||||
JSON.stringify({
|
||||
version: process.env.npm_package_version,
|
||||
...JSON.parse(content.toString()),
|
||||
})
|
||||
);
|
||||
},
|
||||
to: 'manifest.json',
|
||||
},
|
||||
]),
|
||||
new HtmlWebpackPlugin({
|
||||
template: 'src/options.html',
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user