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

View File

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