From c8910da449e91d274aab44a8c48316240275ba81 Mon Sep 17 00:00:00 2001 From: jamesgeorge007 Date: Tue, 1 Jun 2021 11:00:27 +0530 Subject: [PATCH] fix(create-app): handle invalid template --- packages/create-app/index.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/packages/create-app/index.js b/packages/create-app/index.js index d8db468f51e91a..40546aa66e1bbb 100755 --- a/packages/create-app/index.js +++ b/packages/create-app/index.js @@ -214,17 +214,19 @@ async function init() { return } - const packageName = result.packageName + // user choice associated with prompts + const { framework, overwrite, packageName, variant } = result + const root = path.join(cwd, targetDir) - if (result.overwrite) { + if (overwrite) { emptyDir(root) } else if (!fs.existsSync(root)) { fs.mkdirSync(root) } // determine template - template = template || result.variant || result.framework + template = variant || framework || template console.log(`\nScaffolding project in ${root}...`)