99 isCancel ,
1010 log ,
1111 outro ,
12+ select ,
1213 tasks ,
1314 text ,
1415} from '@clack/prompts' ;
@@ -30,7 +31,8 @@ export default class Init extends BaseCommand {
3031 static flags = {
3132 template : Flags . string ( {
3233 description : 'template to use' ,
33- options : [ 'standalone' , 'nextjs' , 'express' ] ,
34+ options : [ 'next' , 'hono' , 'nitro' ] ,
35+ default : 'next' ,
3436 } ) ,
3537 yes : Flags . boolean ( {
3638 char : 'y' ,
@@ -60,6 +62,8 @@ export default class Init extends BaseCommand {
6062
6163 intro ( 'workflow init' ) ;
6264
65+ let template = flags . template ?? 'next' ;
66+
6367 const isNextApp = this . isNextApp ( ) ;
6468
6569 let createNewProject = true ;
@@ -93,6 +97,24 @@ export default class Init extends BaseCommand {
9397 cancel ( 'Cancelled workflow setup' ) ;
9498 return ;
9599 }
100+
101+ template = ( await select ( {
102+ message : 'What template would you like to use?' ,
103+ options : [
104+ { label : 'Hono' , value : 'hono' , hint : 'via Nitro v3' } ,
105+ { label : 'Next.js' , value : 'next' } ,
106+ {
107+ label : 'Nitro' ,
108+ value : 'nitro' ,
109+ } ,
110+ ] ,
111+ initialValue : 'next' ,
112+ } ) ) as string ;
113+
114+ if ( isCancel ( template ) ) {
115+ cancel ( 'Cancelled workflow setup' ) ;
116+ return ;
117+ }
96118 }
97119
98120 const useTsPlugin =
@@ -113,7 +135,8 @@ export default class Init extends BaseCommand {
113135
114136 await tasks ( [
115137 {
116- title : 'Creating Next.js app' ,
138+ title :
139+ template === 'next' ? 'Creating Next.js app' : 'Creating Hono app' ,
117140 enabled : createNewProject ,
118141 task : async ( message ) => {
119142 message ( 'Creating a new Next.js app' ) ;
@@ -244,6 +267,8 @@ export async function POST(request: Request) {
244267 } ,
245268 ] ) ;
246269
270+ cancel ( 'Cancelled workflow setup' ) ;
271+
247272 outro (
248273 `${ chalk . green ( 'Success!' ) } Next steps:
249274 Run ${ chalk . dim ( `${ createNewProject ? `cd ${ projectName } && ` : '' } npm run dev` ) } to start the development server
0 commit comments