3
3
const { exec } = require ( 'child_process' )
4
4
const { program } = require ( 'commander' ) ;
5
5
const { logger } = require ( './utils/logger' ) ;
6
- const { select, confirm, input } = require ( '@inquirer/prompts' ) ;
6
+ const { select, confirm, input, checkbox } = require ( '@inquirer/prompts' ) ;
7
+ const { componentChoices } = require ( './utils/constants' ) ;
7
8
const CLI = require ( 'clui' ) ;
8
9
const boxen = require ( 'boxen' ) ;
9
10
const themeInit = require ( './commands/themeInit' ) ;
@@ -60,8 +61,15 @@ program.command('project-init')
60
61
{ name : "CRA" , value : "cra" } ,
61
62
{ name : "Vite" , value : "vite" } ,
62
63
{ name : "Next.js" , value : "next" }
63
- ]
64
- } ) ;
64
+ ] ,
65
+ default : 'vite'
66
+ } ) ;
67
+
68
+ const components = await checkbox ( {
69
+ message : "Which components would you like to scafold to your project? You can also install them later via the CLI." ,
70
+ choices : componentChoices ,
71
+ pageSize : 10
72
+ } ) ;
65
73
66
74
const architecture = await select ( {
67
75
message : "Choose your preferred project architecture:" ,
@@ -79,7 +87,7 @@ program.command('project-init')
79
87
const useWorkspaces = await confirm ( { message : "Would you like to integrate Yarn Workspaces with Lerna for better dependency management?" } ) ;
80
88
81
89
function runMonorepo ( ) {
82
- return monorepoInit ( monorepoName , ( ) => projectInit ( projectName , options . all || false , architecture , tool , monorepoName ) ) ;
90
+ return monorepoInit ( monorepoName , ( ) => projectInit ( projectName , components , architecture , tool , monorepoName ) ) ;
83
91
}
84
92
85
93
@@ -103,12 +111,12 @@ program.command('project-init')
103
111
runMonorepo ( ) ;
104
112
} )
105
113
}
106
-
114
+
107
115
} else runMonorepo ( ) ;
108
116
} )
109
117
}
110
118
} else {
111
- projectInit ( projectName , options . all || false , architecture , tool ) ;
119
+ projectInit ( projectName , components , architecture , tool ) ;
112
120
}
113
121
} ) ;
114
122
0 commit comments