From cd07773e3453ee1921120615df3ac4aa89b9620a Mon Sep 17 00:00:00 2001 From: a298003154 <298003154@qq.com> Date: Fri, 27 Mar 2020 19:56:28 +0800 Subject: [PATCH] fix(cli): incorrect ensureDir usage (#5933) --- packages/create-vant-cli-app/src/index.ts | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/packages/create-vant-cli-app/src/index.ts b/packages/create-vant-cli-app/src/index.ts index 7abcc0ef1..4f2e61296 100644 --- a/packages/create-vant-cli-app/src/index.ts +++ b/packages/create-vant-cli-app/src/index.ts @@ -1,6 +1,7 @@ #!/usr/bin/env node import inquirer from 'inquirer'; +import consola from 'consola'; import { ensureDir } from 'fs-extra'; import { VanGenerator } from './generator'; @@ -15,10 +16,14 @@ const PROMPTS = [ export default async function run() { const { name } = await inquirer.prompt(PROMPTS); - ensureDir(name); + try { + await ensureDir(name); - const generator = new VanGenerator(name); - generator.run(); + const generator = new VanGenerator(name); + generator.run(); + } catch (e) { + consola.error(e); + } } run();