@@ -56,8 +56,7 @@ export default async function create(argv: yargs.Arguments<any>) {
56
56
authorEmail,
57
57
authorUrl,
58
58
githubUrl : repo ,
59
- native,
60
- cpp,
59
+ type,
61
60
} = ( await inquirer . prompt ( [
62
61
{
63
62
type : 'input' ,
@@ -126,17 +125,18 @@ export default async function create(argv: yargs.Arguments<any>) {
126
125
validate : ( input ) => / ^ h t t p s ? : \/ \/ / . test ( input ) || 'Must be a valid URL' ,
127
126
} ,
128
127
{
129
- type : 'confirm' ,
130
- name : 'native' ,
131
- message : 'Do you want to use Java or Objective-C code?' ,
132
- default : true ,
133
- } ,
134
- {
135
- type : 'confirm' ,
136
- name : 'cpp' ,
137
- message : 'Do you want to use C++ code?' ,
138
- default : false ,
139
- when : ( response ) => response . native ,
128
+ type : 'list' ,
129
+ name : 'type' ,
130
+ message : 'What type of package do you want to develop?' ,
131
+ choices : [
132
+ { name : 'Native module in Kotlin and Objective-C' , value : 'native' } ,
133
+ { name : 'Native module with C++ code' , value : 'cpp' } ,
134
+ {
135
+ name : 'JavaScript module with Web support using Expo' ,
136
+ value : 'expo' ,
137
+ } ,
138
+ ] ,
139
+ default : 'native' ,
140
140
} ,
141
141
] ) ) as {
142
142
slug : string ;
@@ -145,8 +145,7 @@ export default async function create(argv: yargs.Arguments<any>) {
145
145
authorEmail : string ;
146
146
authorUrl : string ;
147
147
githubUrl : string ;
148
- native : boolean ;
149
- cpp : boolean ;
148
+ type : 'native' | 'cpp' | 'expo' ;
150
149
} ;
151
150
152
151
const project = slug . replace ( / ^ ( r e a c t - n a t i v e - | @ [ ^ / ] + \/ ) / , '' ) ;
@@ -165,8 +164,8 @@ export default async function create(argv: yargs.Arguments<any>) {
165
164
. slice ( 1 ) } `,
166
165
package : slug . replace ( / [ ^ a - z 0 - 9 ] / g, '' ) . toLowerCase ( ) ,
167
166
podspec : slug . replace ( / [ ^ a - z 0 - 9 ] + / g, '-' ) . replace ( / ^ - / , '' ) ,
168
- native,
169
- cpp,
167
+ native : type === 'native' || type === 'cpp' ,
168
+ cpp : type === 'cpp' ,
170
169
} ,
171
170
author : {
172
171
name : authorName ,
@@ -201,16 +200,16 @@ export default async function create(argv: yargs.Arguments<any>) {
201
200
202
201
await copyDir ( COMMON_FILES , folder ) ;
203
202
204
- if ( native ) {
205
- await copyDir ( NATIVE_FILES , folder ) ;
206
- } else {
203
+ if ( type === 'expo' ) {
207
204
await copyDir ( EXPO_FILES , folder ) ;
208
- }
209
-
210
- if ( cpp ) {
211
- await copyDir ( CPP_FILES , folder ) ;
212
205
} else {
213
- await copyDir ( OBJC_FILES , folder ) ;
206
+ await copyDir ( NATIVE_FILES , folder ) ;
207
+
208
+ if ( type === 'cpp' ) {
209
+ await copyDir ( CPP_FILES , folder ) ;
210
+ } else {
211
+ await copyDir ( OBJC_FILES , folder ) ;
212
+ }
214
213
}
215
214
216
215
try {
@@ -226,7 +225,7 @@ export default async function create(argv: yargs.Arguments<any>) {
226
225
const platforms = {
227
226
ios : { name : 'iOS' , color : 'cyan' } ,
228
227
android : { name : 'Android' , color : 'green' } ,
229
- ...( native ? null : { web : { name : 'Web' , color : 'blue' } } ) ,
228
+ ...( type === 'expo' ? { web : { name : 'Web' , color : 'blue' } } : null ) ,
230
229
} ;
231
230
232
231
console . log (
0 commit comments