@@ -12,7 +12,7 @@ import {
1212 SUPPORTED_PACKAGE_MANAGERS ,
1313 getPackageManager ,
1414} from './package-manager.js'
15- import { CODE_ROUTER , FILE_ROUTER } from './constants.js'
15+ import { CODE_ROUTER , DEFAULT_FRAMEWORK , FILE_ROUTER } from './constants.js'
1616import { finalizeAddOns , getAllAddOns } from './add-ons.js'
1717import type { Variable } from './add-ons.js'
1818
@@ -25,12 +25,19 @@ export function normalizeOptions(
2525 if ( cliOptions . projectName ) {
2626 const typescript =
2727 cliOptions . template === 'typescript' ||
28- cliOptions . template === 'file-router'
28+ cliOptions . template === 'file-router' ||
29+ cliOptions . framework === 'solid'
30+
31+ const tailwind =
32+ cliOptions . tailwind === undefined
33+ ? cliOptions . framework === 'solid'
34+ : cliOptions . tailwind
2935
3036 return {
37+ framework : cliOptions . framework || 'react' ,
3138 projectName : cliOptions . projectName ,
3239 typescript,
33- tailwind : ! ! cliOptions . tailwind ,
40+ tailwind : ! ! tailwind ,
3441 packageManager : cliOptions . packageManager || DEFAULT_PACKAGE_MANAGER ,
3542 mode : cliOptions . template === 'file-router' ? FILE_ROUTER : CODE_ROUTER ,
3643 git : ! ! cliOptions . git ,
@@ -86,6 +93,12 @@ export async function promptForOptions(
8693) : Promise < Required < Options > > {
8794 const options = { } as Required < Options >
8895
96+ options . framework = cliOptions . framework || DEFAULT_FRAMEWORK
97+ if ( options . framework === 'solid' ) {
98+ options . typescript = true
99+ options . tailwind = true
100+ }
101+
89102 if ( ! cliOptions . projectName ) {
90103 const value = await text ( {
91104 message : 'What would you like to name your project?' ,
@@ -151,7 +164,7 @@ export async function promptForOptions(
151164 }
152165
153166 // Tailwind selection
154- if ( cliOptions . tailwind === undefined ) {
167+ if ( cliOptions . tailwind === undefined && options . framework === 'react' ) {
155168 const tailwind = await confirm ( {
156169 message : 'Would you like to use Tailwind CSS?' ,
157170 initialValue : true ,
@@ -162,7 +175,7 @@ export async function promptForOptions(
162175 }
163176 options . tailwind = tailwind
164177 } else {
165- options . tailwind = cliOptions . tailwind
178+ options . tailwind = options . framework === 'solid' || ! ! cliOptions . tailwind
166179 }
167180
168181 // Package manager selection
@@ -190,44 +203,54 @@ export async function promptForOptions(
190203 }
191204
192205 // Select any add-ons
193- if ( options . mode === FILE_ROUTER && cliOptions . addOns ) {
194- const addOns = await getAllAddOns ( )
195-
196- const selectedAddOns = await multiselect ( {
206+ const allAddOns = await getAllAddOns ( options . framework )
207+ const addOns = allAddOns . filter ( ( addOn ) => addOn . type === 'add-on' )
208+ let selectedAddOns : Array < string > = [ ]
209+ if ( options . mode === FILE_ROUTER && cliOptions . addOns && addOns . length > 0 ) {
210+ const value = await multiselect ( {
197211 message : 'What add-ons would you like for your project:' ,
198- options : addOns
199- . filter ( ( addOn ) => addOn . type === 'add-on' )
200- . map ( ( addOn ) => ( {
201- value : addOn . id ,
202- label : addOn . name ,
203- hint : addOn . description ,
204- } ) ) ,
212+ options : addOns . map ( ( addOn ) => ( {
213+ value : addOn . id ,
214+ label : addOn . name ,
215+ hint : addOn . description ,
216+ } ) ) ,
205217 required : false ,
206218 } )
207219
208220 if ( isCancel ( selectedAddOns ) ) {
209221 cancel ( 'Operation cancelled.' )
210222 process . exit ( 0 )
211223 }
224+ selectedAddOns = value as Array < string >
225+ }
212226
213- const selectedExamples = await multiselect ( {
227+ // Select any examples
228+ const examples = allAddOns . filter ( ( addOn ) => addOn . type === 'example' )
229+ let selectedExamples : Array < string > = [ ]
230+ if (
231+ options . mode === FILE_ROUTER &&
232+ cliOptions . addOns &&
233+ examples . length > 0
234+ ) {
235+ const value = await multiselect ( {
214236 message : 'Would you like any examples?' ,
215- options : addOns
216- . filter ( ( addOn ) => addOn . type === 'example' )
217- . map ( ( addOn ) => ( {
218- value : addOn . id ,
219- label : addOn . name ,
220- hint : addOn . description ,
221- } ) ) ,
237+ options : examples . map ( ( addOn ) => ( {
238+ value : addOn . id ,
239+ label : addOn . name ,
240+ hint : addOn . description ,
241+ } ) ) ,
222242 required : false ,
223243 } )
224244
225- if ( isCancel ( selectedExamples ) ) {
245+ if ( isCancel ( value ) ) {
226246 cancel ( 'Operation cancelled.' )
227247 process . exit ( 0 )
228248 }
249+ selectedExamples = value
250+ }
229251
230- options . chosenAddOns = await finalizeAddOns ( [
252+ if ( selectedAddOns . length > 0 || selectedExamples . length > 0 ) {
253+ options . chosenAddOns = await finalizeAddOns ( options . framework , [
231254 ...selectedAddOns ,
232255 ...selectedExamples ,
233256 ] )
0 commit comments