also looking at this
fix(cli): validate scaffold templates before creating projects
#298
4 files
+53
-7
| @@ -66,6 +66,11 @@ cli | ||
| 66 | 66 | } |
| 67 | 67 | |
| 68 | 68 | const template = options?.template || 'minimal' |
| 69 | if (!['minimal', 'full-featured', 'todo-app'].includes(template)) { | |
| 70 | console.error(`Error: Unknown template "${template}"`) | |
| 71 | console.error('Available templates: minimal, full-featured, todo-app') | |
| 72 | process.exit(1) | |
| 73 | } | |
| 69 | 74 | const skipInstall = options?.skipInstall || false |
| 70 | 75 | |
| 71 | 76 | console.log(`\n✨ Creating a new Craft app: ${projectName}`) |
| @@ -92,11 +97,6 @@ cli | ||
| 92 | 97 | else if (template === 'todo-app') { |
| 93 | 98 | createTodoAppTemplate(projectPath, projectName) |
| 94 | 99 | } |
| 95 | else { | |
| 96 | console.error(`Error: Unknown template "${template}"`) | |
| 97 | console.log('\nAvailable templates: minimal, full-featured, todo-app') | |
| 98 | process.exit(1) | |
| 99 | } | |
| 100 | 100 | |
| 101 | 101 | // Install dependencies unless skipped |
| 102 | 102 | if (!skipInstall) { |