Skip to content

Commit

Permalink
fix(create-app): update prompt message based on user input (#2103)
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesgeorge007 authored Feb 19, 2021
1 parent c391ea3 commit 038f786
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions packages/create-app/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
/**
Expand Down

0 comments on commit 038f786

Please sign in to comment.