fix(nuxi): validations for `--template` flag (#1412)

This commit is contained in:
James George 2021-10-24 20:18:02 +05:30 committed by GitHub
parent bd010313db
commit 110b2b2680
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 10 additions and 1 deletions

View File

@ -14,11 +14,20 @@ const knownTemplates = {
}
const resolveTemplate = (template) => {
if (!template) {
return knownTemplates.nuxt3
}
if (typeof template === 'boolean') {
consola.error('Please specify a template')
process.exit(1)
}
if (template in knownTemplates) {
return knownTemplates[template]
}
if (typeof template === 'string' && template.includes('/')) {
if (template.includes('/')) {
return template
}