Skip to content

Commit 8c6c069

Browse files
committed
chore(script): add update version script
1 parent 428f231 commit 8c6c069

3 files changed

Lines changed: 18 additions & 2 deletions

File tree

.eslintrc.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ module.exports = {
1818
browser: true,
1919
es2021: true,
2020
},
21-
ignorePatterns: ['.eslintrc.js', 'dist/*', 'webpack.*.js'],
21+
ignorePatterns: ['.eslintrc.js', 'dist/*', 'webpack.*.js', 'scripts/*'],
2222
rules: {
2323
'@typescript-eslint/interface-name-prefix': 'off',
2424
'@typescript-eslint/explicit-function-return-type': 'off',

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@
1111
"build": "rimraf dist && webpack --config webpack.prod.js",
1212
"clean": "rimraf dist",
1313
"format": "prettier --write \"**/*.{js,ts,tsx,css}\"",
14-
"lint": "eslint \"**/*.{js,ts,tsx}\" --fix"
14+
"lint": "eslint \"**/*.{js,ts,tsx}\" --fix",
15+
"update-version": "node ./scripts/update-version.js"
1516
},
1617
"dependencies": {
1718
"clsx": "^1.1.1",

scripts/update-version.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
const fs = require('fs');
2+
3+
const packagePath = './package.json';
4+
const manifestPath = './public/manifest.json';
5+
6+
const newVersion = process.argv[3];
7+
8+
const readAndWriteNewVersion = (path) => {
9+
const data = JSON.parse(fs.readFileSync(path));
10+
data.version = newVersion;
11+
fs.writeFileSync(path, JSON.stringify(data, null, 2));
12+
};
13+
14+
readAndWriteNewVersion(packagePath);
15+
readAndWriteNewVersion(manifestPath);

0 commit comments

Comments
 (0)