feat: script for sync manifest version

This commit is contained in:
EnixCoda 2018-09-13 22:09:45 +08:00
parent 5c1e714b18
commit eaa4c94e53
3 changed files with 13 additions and 1 deletions

View file

@ -3,7 +3,8 @@
"env": {
"browser": true,
"commonjs": true,
"es6": true
"es6": true,
"node": true
},
"parserOptions": {
"ecmaFeatures": {

View file

@ -9,6 +9,7 @@
"scripts": {
"start": "webpack --watch",
"dev": "webpack",
"stamp": "node scripts/version.js",
"prod": "NODE_ENV=production webpack && cd dist && rm -f ./gitako.zip && zip gitako.zip -r *"
},
"dependencies": {

10
scripts/version.js Normal file
View file

@ -0,0 +1,10 @@
const fs = require('fs')
const path = require('path')
const rootPath = path.resolve(__dirname, '../')
const packageJSON = require(path.resolve(rootPath, 'package.json'))
const manifestPath = path.resolve(rootPath, 'src/manifest.json');
const manifest = require(manifestPath)
manifest.version = packageJSON.version
fs.writeFileSync(manifestPath, JSON.stringify(manifest), 'utf-8')