From 038f78660042454935ef343bce240a5220328760 Mon Sep 17 00:00:00 2001 From: James George Date: Sat, 20 Feb 2021 01:33:24 +0530 Subject: [PATCH] fix(create-app): update prompt message based on user input (#2103) --- packages/create-app/index.js | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/packages/create-app/index.js b/packages/create-app/index.js index 89845a0e86e106..489c7f02ace65b 100755 --- a/packages/create-app/index.js +++ b/packages/create-app/index.js @@ -76,12 +76,15 @@ async function init() { // determine template let template = argv.t || argv.template - - const availableTemplates = TEMPLATES.map((template) => stripColors(template)) - const isValidTemplate = availableTemplates.includes(template) - const message = isValidTemplate - ? `Select a template:` - : `${template} isn't a valid template. Please choose from below: ` + let message = 'Select a template:' + let isValidTemplate = false + + // --template expects a value + if (typeof template === 'string') { + const availableTemplates = TEMPLATES.map(stripColors) + isValidTemplate = availableTemplates.includes(template) + message = `${template} isn't a valid template. Please choose from below:` + } if (!template || !isValidTemplate) { /**