From ff8e7cb0a532c953dd175d927abb26f81932b891 Mon Sep 17 00:00:00 2001 From: "pengfei.zhou" Date: Fri, 26 Mar 2021 14:50:00 +0800 Subject: [PATCH] feat:Add return code for cli build --- doric-cli/src/actions.ts | 5 +++-- doric-cli/src/index.ts | 5 ++++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/doric-cli/src/actions.ts b/doric-cli/src/actions.ts index bc122389..0c297f7b 100644 --- a/doric-cli/src/actions.ts +++ b/doric-cli/src/actions.ts @@ -12,7 +12,7 @@ export async function build() { }); if (ret !== 0) { console.log("Compile error".red); - return; + return -1; } ret = await Shell.exec("node", ["node_modules/.bin/rollup", "-c",], { env: process.env, @@ -22,7 +22,7 @@ export async function build() { }); if (ret !== 0) { console.log("Compile error".red); - return; + return -1; } const bundleFiles = await glob("bundle/**/*.js"); for (let bundleFile of bundleFiles) { @@ -41,6 +41,7 @@ export async function build() { } } } + return 0 } export async function clean() { diff --git a/doric-cli/src/index.ts b/doric-cli/src/index.ts index 20a18c0c..4e9e4c71 100644 --- a/doric-cli/src/index.ts +++ b/doric-cli/src/index.ts @@ -26,7 +26,10 @@ commander commander .command('build') .action(async function () { - await build(); + const ret = await build(); + if (ret != 0) { + process.exit(ret) + } }) commander .command('clean')