diff --git a/src/manifests/chrome.json b/src/manifests/chrome.json index 8c95ac3..a810bf4 100644 --- a/src/manifests/chrome.json +++ b/src/manifests/chrome.json @@ -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'", diff --git a/src/manifests/firefox.json b/src/manifests/firefox.json index 9053802..112d060 100644 --- a/src/manifests/firefox.json +++ b/src/manifests/firefox.json @@ -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": { diff --git a/src/manifests/opera.json b/src/manifests/opera.json index 5792ffa..897b731 100644 --- a/src/manifests/opera.json +++ b/src/manifests/opera.json @@ -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'", diff --git a/webpack.config.js b/webpack.config.js index 5caab89..fe47b34 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -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',