Skip to content

Commit 89bab96

Browse files
Automate manifest version bumping
1 parent 285b51b commit 89bab96

File tree

3 files changed

+21
-6
lines changed

3 files changed

+21
-6
lines changed

manifest.json manifest.js

+8-4
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
1-
{
2-
"manifest_version": 2,
1+
const { version } = require("./package.json");
2+
3+
const manifest = {
4+
"manifest_version": 2,
35

46
"name": "Coder's Calendar",
57
"short_name": "Coder's Calendar",
68
"description": "Never miss a Coding contest again! Displays live and upcoming Programming Contests happening on a variety of popular platforms.",
7-
"version": "1.5.0",
9+
"version": version,
810

911
"permissions": [
1012
"http://contesttrackerapi.herokuapp.com/",
@@ -25,4 +27,6 @@
2527
"scripts": ["js/event_listeners.js"]
2628
},
2729
"content_security_policy": "script-src 'self' https://www.google-analytics.com; object-src 'self'"
28-
}
30+
};
31+
32+
module.exports = manifest

package.json

+1
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
"babel-preset-react": "^6.24.1",
2525
"clean-webpack-plugin": "^2.0.1",
2626
"copy-webpack-plugin": "^4.5.2",
27+
"create-file-webpack": "^1.0.2",
2728
"eslint": "^4.2.0",
2829
"eslint-config-airbnb": "^17.0.0",
2930
"eslint-plugin-import": "^2.13.0",

webpack.config.js

+12-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
const CopyWebpackPlugin = require('copy-webpack-plugin')
22
const ZipPlugin = require('zip-webpack-plugin');
33
const CleanWebpackPlugin = require('clean-webpack-plugin');
4+
const CreateFileWebpack = require('create-file-webpack')
45
const path = require('path');
56

7+
const manifest = require("./manifest");
68
const { version } = require('./package.json');
79

810
module.exports = [
@@ -28,10 +30,14 @@ module.exports = [
2830
cleanOnceBeforeBuildPatterns: ['**\/*', path.join(process.cwd(), 'build/*_Chrome.zip')],
2931
dangerouslyAllowCleanPatternsOutsideProject: true
3032
}),
33+
new CreateFileWebpack({
34+
fileName: 'manifest.json',
35+
path: __dirname + '/build/chrome',
36+
content: JSON.stringify(manifest)
37+
}),
3138
new CopyWebpackPlugin([
3239
{ from: 'css/chrome.css', to: 'css/index.css' },
3340
{ from: 'index.html', to: 'index.html' },
34-
{ from: 'manifest.json', to: 'manifest.json' },
3541
{ from: 'img', to: 'img' },
3642
{ from: 'font-awesome', to: 'font-awesome' }
3743
]),
@@ -63,10 +69,14 @@ module.exports = [
6369
cleanOnceBeforeBuildPatterns: ['**\/*', path.join(process.cwd(), 'build/*_Firefox.zip')],
6470
dangerouslyAllowCleanPatternsOutsideProject: true
6571
}),
72+
new CreateFileWebpack({
73+
fileName: 'manifest.json',
74+
path: __dirname + '/build/firefox',
75+
content: JSON.stringify(manifest)
76+
}),
6677
new CopyWebpackPlugin([
6778
{ from: 'css/firefox.css', to: 'css/index.css' },
6879
{ from: 'index.html', to: 'index.html' },
69-
{ from: 'manifest.json', to: 'manifest.json' },
7080
{ from: 'img', to: 'img' },
7181
{ from: 'font-awesome', to: 'font-awesome' }
7282
]),

0 commit comments

Comments
 (0)