@@ -48,8 +48,8 @@ export class New extends Command {
48
48
static flags = {
49
49
help : Flags . help ( { char : 'h' } ) ,
50
50
template : Flags . string ( {
51
- description : 'Pick your new app template. Options: minimal, blog.' ,
52
- options : [ 'minimal, blog' ] ,
51
+ description : 'Pick your new app template. Options: starter- blog.' ,
52
+ options : [ 'starter- blog' ] ,
53
53
} ) ,
54
54
npm : Flags . boolean ( {
55
55
description : 'Use npm as the package manager' ,
@@ -81,7 +81,7 @@ export class New extends Command {
81
81
private async installTemplate ( flags : Flags , args : Record < string , any > ) : Promise < void > {
82
82
const name = args . name
83
83
// Can revert to `starter/${args.template}` to support more starter templates in the future
84
- const template = `${ args . template } `
84
+ const template = `${ this . template } `
85
85
let cmd
86
86
// Should run no-install regardless of flag and do a post-install
87
87
const opts = [ '--example' , REPO_ROOT , '--example-path' , template , name ]
@@ -147,21 +147,22 @@ export class New extends Command {
147
147
148
148
private async determineTemplate ( flags : Flags ) : Promise < void > {
149
149
if ( flags . template ) {
150
- return
150
+ this . template = flags . template as Template
151
+ } else {
152
+ const choices : Array < { name : Template ; message ?: string } > = [
153
+ { name : 'starter-blog' , message : 'Default starter blog template with tailwind' } ,
154
+ { name : 'starter-doc' , message : 'Documentation template (TODO, WIP)' } ,
155
+ ]
156
+ const { template } = ( await this . enquirer . prompt ( {
157
+ type : 'select' ,
158
+ name : 'template' ,
159
+ message : 'Pick your new app template' ,
160
+ initial : 0 ,
161
+ choices,
162
+ } ) ) as { template : Template }
163
+
164
+ this . template = template
151
165
}
152
- const choices : Array < { name : Template ; message ?: string } > = [
153
- { name : 'starter-blog' , message : 'Default starter blog template with tailwind' } ,
154
- { name : 'starter-doc' , message : 'Documentation template (TODO, WIP)' } ,
155
- ]
156
- const { template } = ( await this . enquirer . prompt ( {
157
- type : 'select' ,
158
- name : 'template' ,
159
- message : 'Pick your new app template' ,
160
- initial : 0 ,
161
- choices,
162
- } ) ) as { template : Template }
163
-
164
- this . template = template
165
166
}
166
167
167
168
async run ( ) {
@@ -171,7 +172,7 @@ export class New extends Command {
171
172
172
173
await this . determineLanguage ( flags )
173
174
// Currently, there's only one starter template - disable option
174
- // await this.determineTemplate(flags)
175
+ await this . determineTemplate ( flags )
175
176
await this . determinePkgManagerToInstallDeps ( flags )
176
177
await this . installTemplate ( flags , args )
177
178
const { pkgManager, template } = this
0 commit comments