@@ -115,8 +115,7 @@ type ArgName =
115115 | 'type'
116116 | 'local'
117117 | 'example'
118- | 'react-native-version'
119- | 'with-recommended-options' ;
118+ | 'react-native-version' ;
120119
121120type ProjectLanguages = 'kotlin-objc' | 'kotlin-swift' | 'cpp' | 'js' ;
122121
@@ -141,7 +140,6 @@ type Answers = {
141140 type ?: ProjectType ;
142141 example ?: boolean ;
143142 reactNativeVersion ?: string ;
144- withRecommendedOptions ?: boolean ;
145143} ;
146144
147145const LANGUAGE_CHOICES : {
@@ -150,7 +148,7 @@ const LANGUAGE_CHOICES: {
150148 types : ProjectType [ ] ;
151149} [ ] = [
152150 {
153- title : ` Kotlin & Objective-C` ,
151+ title : ' Kotlin & Objective-C' ,
154152 value : 'kotlin-objc' ,
155153 types : [ 'view-module-legacy' , 'view-module-mixed' , 'view-module-new' ] ,
156154 } ,
@@ -221,16 +219,6 @@ const TYPE_CHOICES: {
221219 } ,
222220] ;
223221
224- const RECOMMENDED_TEMPLATE : {
225- type : ProjectType ;
226- languages : ProjectLanguages ;
227- description : string ;
228- } = {
229- type : 'view-module-mixed' ,
230- languages : 'kotlin-objc' ,
231- description : `Backward compatible Fabric view & Turbo module with Kotlin & Objective-C` ,
232- } ;
233-
234222const args : Record < ArgName , yargs . Options > = {
235223 'slug' : {
236224 description : 'Name of the npm package' ,
@@ -277,10 +265,6 @@ const args: Record<ArgName, yargs.Options> = {
277265 type : 'boolean' ,
278266 default : true ,
279267 } ,
280- 'with-recommended-options' : {
281- description : `Whether to use the recommended template. ${ RECOMMENDED_TEMPLATE . description } ` ,
282- type : 'boolean' ,
283- } ,
284268} ;
285269
286270// FIXME: fix the type
@@ -448,68 +432,24 @@ async function create(argv: yargs.Arguments<any>) {
448432 } ,
449433 validate : ( input ) => / ^ h t t p s ? : \/ \/ / . test ( input ) || 'Must be a valid URL' ,
450434 } ,
451- 'with-recommended-options' : {
452- type : 'select' ,
453- name : 'withRecommendedOptions' ,
454- message : 'Do you want to customize the library type and languages?' ,
455- choices : [
456- {
457- title : 'Use recommended defaults' ,
458- value : true ,
459- description : RECOMMENDED_TEMPLATE . description ,
460- } ,
461- {
462- title : 'Customize' ,
463- value : false ,
464- } ,
465- ] ,
466- } ,
467435 'type' : {
468436 type : 'select' ,
469437 name : 'type' ,
470438 message : 'What type of library do you want to develop?' ,
471- choices : ( _ , values ) => {
472- if ( values . withRecommendedOptions ) {
473- return TYPE_CHOICES . filter (
474- ( choice ) => choice . value === RECOMMENDED_TEMPLATE . type
475- ) ;
476- }
477-
478- return TYPE_CHOICES . map ( ( choice ) =>
479- choice . value === RECOMMENDED_TEMPLATE . type
480- ? {
481- ...choice ,
482- title : `${ choice . title } ${ kleur . yellow ( '(Recommended)' ) } ` ,
483- }
484- : choice
485- ) ;
486- } ,
439+ choices : TYPE_CHOICES ,
487440 } ,
488441 'languages' : {
489442 type : 'select' ,
490443 name : 'languages' ,
491444 message : 'Which languages do you want to use?' ,
492445 choices : ( _ , values ) => {
493- if ( values . withRecommendedOptions ) {
494- return LANGUAGE_CHOICES . filter ( ( choice ) => {
495- return choice . value === RECOMMENDED_TEMPLATE . languages ;
496- } ) ;
497- }
498-
499446 return LANGUAGE_CHOICES . filter ( ( choice ) => {
500447 if ( choice . types ) {
501448 return choice . types . includes ( values . type ) ;
502449 }
503450
504451 return true ;
505- } ) . map ( ( choice ) =>
506- choice . value === RECOMMENDED_TEMPLATE . languages
507- ? {
508- ...choice ,
509- title : `${ choice . title } ${ kleur . yellow ( '(Recommended)' ) } ` ,
510- }
511- : choice
512- ) ;
452+ } ) ;
513453 } ,
514454 } ,
515455 } ;
0 commit comments