@@ -158,6 +158,26 @@ async function init() {
158
158
} ;
159
159
} ) ,
160
160
} ,
161
+ {
162
+ type : "select" ,
163
+ name : "packageManager" ,
164
+ message : reset ( "Select a package manager:" ) ,
165
+ initial : 0 ,
166
+ choices : [
167
+ {
168
+ title : "npm" ,
169
+ value : "npm" ,
170
+ } ,
171
+ {
172
+ title : "yarn" ,
173
+ value : "yarn" ,
174
+ } ,
175
+ {
176
+ title : "pnpm" ,
177
+ value : "pnpm" ,
178
+ }
179
+ ] ,
180
+ }
161
181
] ,
162
182
{
163
183
onCancel : ( ) => {
@@ -170,7 +190,7 @@ async function init() {
170
190
process . exit ( 1 ) ;
171
191
}
172
192
173
- const { template : userTemplate , overwrite, packageName } = result ;
193
+ const { template : userTemplate , overwrite, packageName, packageManager } = result ;
174
194
const root = path . join ( cwd , dir ) ;
175
195
176
196
if ( overwrite ) {
@@ -179,9 +199,6 @@ async function init() {
179
199
fs . mkdirSync ( root , { recursive : true } ) ;
180
200
}
181
201
182
- const pkginfo = pkgFromUserAgent ( process . env . npm_config_user_agent ) ;
183
- const manager = pkginfo ? pkginfo . name : "npm" ;
184
-
185
202
const templateDir = path . resolve (
186
203
fileURLToPath ( import . meta. url ) ,
187
204
"../../" ,
@@ -208,16 +225,16 @@ async function init() {
208
225
console . log ( `\n${ green ( "✔" ) } Created project in ${ root } .` ) ;
209
226
if ( root !== cwd ) {
210
227
console . log ( `\n${ green ( "✔" ) } To get started:` ) ;
211
- console . log ( `\n cd ${ root } ` ) ;
228
+ console . log ( `\n cd ${ dir } ` ) ;
212
229
}
213
- switch ( manager ) {
230
+ switch ( packageManager ) {
214
231
case "yarn" :
215
232
console . log ( ` yarn` ) ;
216
233
console . log ( ` yarn dev` ) ;
217
234
break ;
218
235
default :
219
- console . log ( ` ${ manager } install` ) ;
220
- console . log ( ` ${ manager } run dev` ) ;
236
+ console . log ( ` ${ packageManager } install` ) ;
237
+ console . log ( ` ${ packageManager } run dev` ) ;
221
238
break ;
222
239
}
223
240
console . log ( ) ;
0 commit comments