mirror of
https://github.com/EnixCoda/Gitako.git
synced 2026-03-11 08:54:44 +00:00
build: update scripts
This commit is contained in:
parent
b01c0529ca
commit
7fd7abb070
2 changed files with 26 additions and 5 deletions
|
|
@ -7,10 +7,11 @@
|
|||
"license": "MIT",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"postinstall": "node scripts/generate-octicons",
|
||||
"start": "webpack --watch",
|
||||
"stamp": "node scripts/version.js",
|
||||
"postversion": "npm run stamp && git add src/manifest.json && git commit --amend --no-edit",
|
||||
"prod": "npm run stamp && NODE_ENV=production webpack && cd dist && rm -f ./gitako.zip && zip gitako.zip -r *"
|
||||
"postversion": "node scripts/version.js",
|
||||
"build": "NODE_ENV=production webpack && npm run postbuild",
|
||||
"postbuild": "cd dist && rm -f ./gitako.zip && zip gitako.zip -r *"
|
||||
},
|
||||
"dependencies": {
|
||||
"ini": "^1.3.5",
|
||||
|
|
|
|||
|
|
@ -1,10 +1,30 @@
|
|||
/**
|
||||
* copy version from package.json to manifest.json
|
||||
* also remove old git tag for the version
|
||||
*/
|
||||
|
||||
const fs = require('fs')
|
||||
const path = require('path')
|
||||
const cp = require('child_process')
|
||||
|
||||
const rootPath = path.resolve(__dirname, '../')
|
||||
const packageJSON = require(path.resolve(rootPath, 'package.json'))
|
||||
const packagePath = path.resolve(rootPath, 'package.json')
|
||||
const manifestPath = path.resolve(rootPath, 'src/manifest.json')
|
||||
|
||||
const packageJSON = require(packagePath)
|
||||
const manifest = require(manifestPath)
|
||||
|
||||
manifest.version = packageJSON.version
|
||||
const version = packageJSON.version
|
||||
manifest.version = version
|
||||
fs.writeFileSync(manifestPath, JSON.stringify(manifest, null, ' '), 'utf-8')
|
||||
|
||||
const exec = command => new Promise((resolve, reject) => cp.exec(command, (error, stdout, stderr) =>
|
||||
error ? reject(error) : resolve(stdout || stderr)
|
||||
))
|
||||
|
||||
exec(`git tag -d v${version}`)
|
||||
.then(() =>
|
||||
exec(`git add src/manifest.json && git commit --amend --no-edit`)
|
||||
).then(() =>
|
||||
exec(`git tag v${version}`)
|
||||
).catch(console.error)
|
||||
|
|
|
|||
Loading…
Reference in a new issue