@@ -101,6 +101,7 @@ type PromptResult = {
101
101
e2eFramework ?: 'cypress' | 'nightwatch' | 'playwright'
102
102
experimentFeatures ?: ( typeof EXPERIMENTAL_FEATURE_OPTIONS ) [ number ] [ 'value' ] [ ]
103
103
needsBareboneTemplates ?: boolean
104
+ needsAutomaticalllyInstallDependencies ?: boolean
104
105
}
105
106
106
107
function isValidPackageName ( projectName ) {
@@ -255,6 +256,8 @@ async function init() {
255
256
256
257
// TODO: default to true sometime in the future
257
258
needsBareboneTemplates : false ,
259
+ // TODO: default to false sometime in the future
260
+ needsAutomaticalllyInstallDependencies : false ,
258
261
}
259
262
260
263
intro (
@@ -680,25 +683,50 @@ async function init() {
680
683
} ) ,
681
684
)
682
685
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
+
683
694
let outroMessage = `${ language . infos . done } \n\n`
684
695
if ( root !== cwd ) {
685
696
const cdProjectName = path . relative ( cwd , root )
686
697
outroMessage += ` ${ bold ( green ( `cd ${ cdProjectName . includes ( ' ' ) ? `"${ cdProjectName } "` : cdProjectName } ` ) ) } \n`
687
698
}
688
- outroMessage += ` ${bold ( green ( getCommand ( packageManager , 'install' ) ) ) } \n`
699
+ if ( ! result . needsAutomaticalllyInstallDependencies ) {
700
+ outroMessage += ` ${bold ( green ( getCommand ( packageManager , 'install' ) ) ) } \n`
701
+ }
689
702
if ( needsPrettier ) {
690
703
outroMessage += ` ${bold ( green ( getCommand ( packageManager , 'format' ) ) ) } \n`
691
704
}
692
705
outroMessage += ` ${bold ( green ( getCommand ( packageManager , 'dev' ) ) ) } \n`
693
706
694
707
if ( ! dotGitDirectoryState . hasDotGitDirectory ) {
695
708
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
699
716
}
700
717
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
+ } )
702
730
}
703
731
704
732
init ( ) . catch ( ( e ) => {
0 commit comments