@@ -318,7 +318,6 @@ async function init() {
318318
319319 if ( customCommand ) {
320320 const fullCustomCommand = customCommand
321- . replace ( 'TARGET_DIR' , targetDir )
322321 . replace ( / ^ n p m c r e a t e / , `${ pkgManager } create` )
323322 // Only Yarn 1.x doesn't support `@version` in the `create` command
324323 . replace ( '@latest' , ( ) => ( isYarn1 ? '' : '@latest' ) )
@@ -336,7 +335,9 @@ async function init() {
336335 } )
337336
338337 const [ command , ...args ] = fullCustomCommand . split ( ' ' )
339- const { status } = spawn . sync ( command , args , {
338+ // we replace TARGET_DIR here because targetDir may include a space
339+ const replacedArgs = args . map ( ( arg ) => arg . replace ( 'TARGET_DIR' , targetDir ) )
340+ const { status } = spawn . sync ( command , replacedArgs , {
340341 stdio : 'inherit' ,
341342 } )
342343 process . exit ( status ?? 0 )
@@ -376,9 +377,14 @@ async function init() {
376377 setupReactSwc ( root , template . endsWith ( '-ts' ) )
377378 }
378379
380+ const cdProjectName = path . relative ( cwd , root )
379381 console . log ( `\nDone. Now run:\n` )
380382 if ( root !== cwd ) {
381- console . log ( ` cd ${ path . relative ( cwd , root ) } ` )
383+ console . log (
384+ ` cd ${
385+ cdProjectName . includes ( ' ' ) ? `"${ cdProjectName } "` : cdProjectName
386+ } `,
387+ )
382388 }
383389 switch ( pkgManager ) {
384390 case 'yarn' :
0 commit comments