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",
|
"name": "Sample WebExtension",
|
||||||
"version": "0.0.1",
|
|
||||||
"author": "abhijithvijayan",
|
"author": "abhijithvijayan",
|
||||||
"short_name": "Sample Name",
|
"short_name": "Sample Name",
|
||||||
"description": "Sample description",
|
"description": "Sample description",
|
||||||
@ -10,6 +8,7 @@
|
|||||||
"persistent": false,
|
"persistent": false,
|
||||||
"scripts": ["js/background.js"]
|
"scripts": ["js/background.js"]
|
||||||
},
|
},
|
||||||
|
"manifest_version": 2,
|
||||||
"minimum_chrome_version": "49",
|
"minimum_chrome_version": "49",
|
||||||
"permissions": ["tabs", "storage", "http://*/*", "https://*/*"],
|
"permissions": ["tabs", "storage", "http://*/*", "https://*/*"],
|
||||||
"content_security_policy": "script-src 'self' 'unsafe-eval'; object-src 'self'",
|
"content_security_policy": "script-src 'self' 'unsafe-eval'; object-src 'self'",
|
||||||
|
|||||||
@ -1,7 +1,5 @@
|
|||||||
{
|
{
|
||||||
"manifest_version": 2,
|
|
||||||
"name": "Sample WebExtension",
|
"name": "Sample WebExtension",
|
||||||
"version": "0.0.1",
|
|
||||||
"author": "abhijithvijayan",
|
"author": "abhijithvijayan",
|
||||||
"short_name": "Sample Name",
|
"short_name": "Sample Name",
|
||||||
"description": "Sample description",
|
"description": "Sample description",
|
||||||
@ -9,6 +7,7 @@
|
|||||||
"background": {
|
"background": {
|
||||||
"scripts": ["js/background.js"]
|
"scripts": ["js/background.js"]
|
||||||
},
|
},
|
||||||
|
"manifest_version": 2,
|
||||||
"permissions": ["tabs", "storage", "http://*/*", "https://*/*"],
|
"permissions": ["tabs", "storage", "http://*/*", "https://*/*"],
|
||||||
"content_security_policy": "script-src 'self' 'unsafe-eval'; object-src 'self'",
|
"content_security_policy": "script-src 'self' 'unsafe-eval'; object-src 'self'",
|
||||||
"icons": {
|
"icons": {
|
||||||
|
|||||||
@ -1,7 +1,5 @@
|
|||||||
{
|
{
|
||||||
"manifest_version": 2,
|
|
||||||
"name": "Sample WebExtension",
|
"name": "Sample WebExtension",
|
||||||
"version": "0.0.1",
|
|
||||||
"developer": {
|
"developer": {
|
||||||
"name": "abhijithvijayan"
|
"name": "abhijithvijayan"
|
||||||
},
|
},
|
||||||
@ -12,6 +10,7 @@
|
|||||||
"persistent": false,
|
"persistent": false,
|
||||||
"scripts": ["js/background.js"]
|
"scripts": ["js/background.js"]
|
||||||
},
|
},
|
||||||
|
"manifest_version": 2,
|
||||||
"minimum_opera_version": "36",
|
"minimum_opera_version": "36",
|
||||||
"permissions": ["tabs", "storage", "http://*/*", "https://*/*"],
|
"permissions": ["tabs", "storage", "http://*/*", "https://*/*"],
|
||||||
"content_security_policy": "script-src 'self' 'unsafe-eval'; object-src 'self'",
|
"content_security_policy": "script-src 'self' 'unsafe-eval'; object-src 'self'",
|
||||||
|
|||||||
@ -35,7 +35,20 @@ module.exports = {
|
|||||||
}),
|
}),
|
||||||
new CopyWebpackPlugin([
|
new CopyWebpackPlugin([
|
||||||
{ from: 'src/assets', to: 'assets' },
|
{ 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({
|
new HtmlWebpackPlugin({
|
||||||
template: 'src/options.html',
|
template: 'src/options.html',
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user