2018-12-30 11:22:12 +08:00
|
|
|
const shell = require ('shelljs');
|
|
|
|
const packageJson = require ('./package.json');
|
|
|
|
|
2019-01-15 14:25:50 +08:00
|
|
|
const version = "v" + packageJson.version;
|
2018-12-30 12:42:15 +08:00
|
|
|
|
|
|
|
if(!version){
|
|
|
|
console.error('version 不能为空')
|
|
|
|
process.exit(1)
|
|
|
|
}
|
2018-12-30 11:22:12 +08:00
|
|
|
|
|
|
|
shell.exec ('npm install --registry https://registry.npm.taobao.org');
|
|
|
|
shell.exec ('npm run build-client');
|
|
|
|
shell.exec ('git add .');
|
|
|
|
shell.exec ('git commit -a -m "chore: update static file"');
|
|
|
|
|
|
|
|
console.log ('exec: git pull origin master');
|
|
|
|
shell.exec ('git pull origin master');
|
|
|
|
let a = shell.exec (`git tag |grep ${version} |wc -l`);
|
|
|
|
if (a && parseInt (a) > 0) {
|
2018-12-30 12:37:41 +08:00
|
|
|
shell.exec ('git tag -d ' + version);
|
|
|
|
shell.exec ('git push origin :' + version);
|
2018-12-30 11:22:12 +08:00
|
|
|
}
|
|
|
|
shell.exec ('git tag ' + version);
|
|
|
|
shell.exec ('git push origin ' + version);
|
|
|
|
|
|
|
|
console.log('git push success', version)
|
|
|
|
|
|
|
|
console.log('正在执行npm发布')
|
2018-12-30 12:32:44 +08:00
|
|
|
shell.exec('npm publish')
|