更新readme

master
xiejianxiong 5 years ago
parent bb731e4779
commit 4d64f24741

@ -2,6 +2,7 @@
# 使用方式
1. npm link
2. 更改 utils/config.js 文件中的 codePath、buildPath 地址
2. auto p test 发布 测试 test-build 版本
2. auto p pre 发布 预上线 pre-build 版本
2. auto p pro 发布 正式 build 版本

@ -5,6 +5,8 @@ const shell = require('shelljs');
const execa = require('execa');
const { Config } = require('../utils/config');
const buildPath = Config.buildPath;
const codePath = Config.codePath;
program.parse(process.argv);
const env = program.args[0];
@ -23,7 +25,7 @@ if (!mappingBranch[env]) {
const runBuild = (task) => new Promise(async resolve => {
try {
shell.cd(Config.codePath);
shell.cd(codePath);
await execa('git', ['checkout', mappingBranch[env].code]);
await execa('git', ['pull', 'origin', mappingBranch[env].code]);
await execa('npm', ['run', 'build', 'test-build']);
@ -37,12 +39,12 @@ const runBuild = (task) => new Promise(async resolve => {
const deleteBuild = (task) => new Promise(async resolve => {
try {
shell.cd(Config.buildPath);
shell.cd(buildPath);
await execa('git', ['checkout', mappingBranch[env].build]);
await execa('git', ['pull', 'origin', mappingBranch[env].build]);
shell.rm(`${Config.buildPath}/*`);
shell.rm('-rf', `${Config.buildPath}/static`);
shell.rm(`${buildPath}/*`);
shell.rm('-rf', `${buildPath}/static`);
await execa('git', ['add', '.']);
await execa('git', ['commit', '-m', `'发布新版本'`]);
@ -57,9 +59,9 @@ const deleteBuild = (task) => new Promise(async resolve => {
const copyBuild = (task) => new Promise(async resolve => {
try {
shell.cp('-r', `${Config.codePath}/dist/*`, Config.buildPath);
shell.cp('-r', `${codePath}/dist/*`, buildPath);
shell.cd(Config.buildPath);
shell.cd(buildPath);
await execa('git', ['add', '.']);
await execa('git', ['commit', '-m', `'发布新版本'`]);
await execa('git', ['push', 'origin', mappingBranch[env].build]);

Loading…
Cancel
Save