@@ -101,6 +101,7 @@ type PromptResult = {
101101 e2eFramework ?: 'cypress' | 'nightwatch' | 'playwright'
102102 experimentFeatures ?: ( typeof EXPERIMENTAL_FEATURE_OPTIONS ) [ number ] [ 'value' ] [ ]
103103 needsBareboneTemplates ? : boolean
104+ needsAutomaticalllyInstallDependencies ? : boolean
104105}
105106
106107function isValidPackageName ( projectName ) {
@@ -255,6 +256,8 @@ async function init() {
255256
256257 // TODO: default to true sometime in the future
257258 needsBareboneTemplates : false ,
259+ // TODO: default to false sometime in the future
260+ needsAutomaticalllyInstallDependencies : false ,
258261 }
259262
260263 intro (
@@ -680,25 +683,50 @@ async function init() {
680683 } ) ,
681684 )
682685
686+ result . needsAutomaticalllyInstallDependencies = await unwrapPrompt (
687+ confirm ( {
688+ message : language . needsAutomaticalllyInstallDependencies . message ,
689+ // TODO: default to true sometime in the future
690+ initialValue : false ,
691+ } ) ,
692+ )
693+
683694 let outroMessage = `${ language . infos . done } \n\n`
684695 if ( root !== cwd ) {
685696 const cdProjectName = path . relative ( cwd , root )
686697 outroMessage += ` ${ bold ( green ( `cd ${ cdProjectName . includes ( ' ' ) ? `"${ cdProjectName } "` : cdProjectName } ` ) ) } \n`
687698 }
688- outroMessage += ` ${bold ( green ( getCommand ( packageManager , 'install' ) ) ) } \n`
699+ if ( ! result . needsAutomaticalllyInstallDependencies ) {
700+ outroMessage += ` ${bold ( green ( getCommand ( packageManager , 'install' ) ) ) } \n`
701+ }
689702 if ( needsPrettier ) {
690703 outroMessage += ` ${bold ( green ( getCommand ( packageManager , 'format' ) ) ) } \n`
691704 }
692705 outroMessage += ` ${bold ( green ( getCommand ( packageManager , 'dev' ) ) ) } \n`
693706
694707 if ( ! dotGitDirectoryState . hasDotGitDirectory ) {
695708 outroMessage += `
696- ${ dim ( '|' ) } ${ language . infos . optionalGitCommand }
697-
698- ${ bold ( green ( 'git init && git add -A && git commit -m "initial commit"' ) ) } `
709+ ${ dim ( '|' ) } ${ language . infos . optionalGitCommand }
710+ ${ bold ( green ( 'git init && git add -A && git commit -m "initial commit"' ) ) } `
711+ }
712+
713+ if ( ! result . needsAutomaticalllyInstallDependencies ) {
714+ outro ( outroMessage )
715+ return
699716 }
700717
701- outro ( outroMessage )
718+ console . log ( `\n\nstarting installation...\n` )
719+ const { spawn } = await import ( 'node:child_process' )
720+ const installArgs = [ 'install' ]
721+ const child = spawn ( 'pnpm' , installArgs , {
722+ cwd : root ,
723+ stdio : 'inherit' ,
724+ shell : process . platform === 'win32' ,
725+ } )
726+
727+ child . on ( 'close' , ( ) => {
728+ console . log ( outroMessage )
729+ } )
702730}
703731
704732init ( ) . catch ( ( e ) => {
0 commit comments