feat(cli): improve error handling

This commit is contained in:
陈嘉涵 2019-12-05 19:46:54 +08:00
parent 187b72483c
commit f7ef1845e8
2 changed files with 8 additions and 7 deletions

View File

@ -56,11 +56,10 @@ async function compileDir(dir: string) {
}
async function buildESModuleOutputs() {
await copy(SRC_DIR, ES_DIR);
stepper.start('Build ESModule Outputs');
try {
await copy(SRC_DIR, ES_DIR);
setModuleEnv('esmodule');
await compileDir(ES_DIR);
stepper.success('Build ESModule Outputs');
@ -70,11 +69,10 @@ async function buildESModuleOutputs() {
}
async function buildCommonjsOutputs() {
await copy(SRC_DIR, LIB_DIR);
stepper.start('Build Commonjs Outputs');
try {
await copy(SRC_DIR, LIB_DIR);
setModuleEnv('commonjs');
await compileDir(LIB_DIR);
stepper.success('Build Commonjs Outputs');
@ -84,10 +82,10 @@ async function buildCommonjsOutputs() {
}
async function buildStyleEntry() {
await genStyleDepsMap();
stepper.start('Build Style Entry');
try {
await genStyleDepsMap();
genComponentStyle();
stepper.success('Build Style Entry');
} catch (err) {

View File

@ -22,7 +22,10 @@ export class VantCliSitePlugin {
genSiteDesktopShared();
resolve();
})
.catch(reject);
.catch(err => {
console.log(err);
reject(err);
});
});
}
}