feat:Add return code for cli build

This commit is contained in:
pengfei.zhou 2021-03-26 14:50:00 +08:00 committed by osborn
parent 0290c7a929
commit ff8e7cb0a5
2 changed files with 7 additions and 3 deletions

View File

@ -12,7 +12,7 @@ export async function build() {
}); });
if (ret !== 0) { if (ret !== 0) {
console.log("Compile error".red); console.log("Compile error".red);
return; return -1;
} }
ret = await Shell.exec("node", ["node_modules/.bin/rollup", "-c",], { ret = await Shell.exec("node", ["node_modules/.bin/rollup", "-c",], {
env: process.env, env: process.env,
@ -22,7 +22,7 @@ export async function build() {
}); });
if (ret !== 0) { if (ret !== 0) {
console.log("Compile error".red); console.log("Compile error".red);
return; return -1;
} }
const bundleFiles = await glob("bundle/**/*.js"); const bundleFiles = await glob("bundle/**/*.js");
for (let bundleFile of bundleFiles) { for (let bundleFile of bundleFiles) {
@ -41,6 +41,7 @@ export async function build() {
} }
} }
} }
return 0
} }
export async function clean() { export async function clean() {

View File

@ -26,7 +26,10 @@ commander
commander commander
.command('build') .command('build')
.action(async function () { .action(async function () {
await build(); const ret = await build();
if (ret != 0) {
process.exit(ret)
}
}) })
commander commander
.command('clean') .command('clean')