16
16
* in a CODEGEN_CONFIG_FILENAME file.
17
17
*/
18
18
19
- const { execSync , execFileSync} = require ( 'child_process' ) ;
19
+ const { execFileSync} = require ( 'child_process' ) ;
20
20
const fs = require ( 'fs' ) ;
21
21
const os = require ( 'os' ) ;
22
22
const path = require ( 'path' ) ;
@@ -185,14 +185,16 @@ function main(appRootDir, outputPath) {
185
185
console . log (
186
186
'\n\n[Codegen] >>>>> Building react-native-codegen package' ,
187
187
) ;
188
- execSync ( 'yarn install' , {
188
+ // [TODO(macOS GH#774) - use execFileSync to help keep shell commands clean
189
+ execFileSync ( 'yarn' , [ 'install' ] , {
189
190
cwd : codegenCliPath ,
190
191
stdio : 'inherit' ,
191
192
} ) ;
192
- execSync ( 'yarn build' , {
193
+ execFileSync ( 'yarn' , [ ' build'] , {
193
194
cwd : codegenCliPath ,
194
195
stdio : 'inherit' ,
195
196
} ) ;
197
+ // ]TODO(macOS GH#774)
196
198
}
197
199
} else if ( fs . existsSync ( CODEGEN_NPM_PATH ) ) {
198
200
codegenCliPath = CODEGEN_NPM_PATH ;
@@ -235,8 +237,7 @@ function main(appRootDir, outputPath) {
235
237
console . log ( `\n\n[Codegen] >>>>> Processing ${ library . config . name } ` ) ;
236
238
// Generate one schema for the entire library...
237
239
// [TODO(macOS GH#774) - use execFileSync to help keep shell commands clean
238
- execFileSync (
239
- 'node' ,
240
+ execFileSync ( 'node' , [
240
241
path . join (
241
242
codegenCliPath ,
242
243
'lib' ,
@@ -246,17 +247,17 @@ function main(appRootDir, outputPath) {
246
247
) ,
247
248
pathToSchema ,
248
249
pathToJavaScriptSources ,
249
- ) ; // ]TODO(macOS GH#774)
250
+ ] ) ; // ]TODO(macOS GH#774)
250
251
console . log ( `[Codegen] Generated schema: ${ pathToSchema } ` ) ;
251
252
252
253
// ...then generate native code artifacts.
254
+ // [TODO(macOS GH#774) - use execFileSync to help keep shell commands clean
253
255
const libraryTypeArg = library . config . type
254
- ? ` --libraryType ${ library . config . type } `
255
- : '' ;
256
+ ? [ ' --libraryType' , library . config . type ]
257
+ : null ; // ]TODO(macOS GH#774)
256
258
fs . mkdirSync ( pathToTempOutputDir , { recursive : true } ) ;
257
259
// [TODO(macOS GH#774) - use execFileSync to help keep shell commands clean
258
- execFileSync (
259
- 'node' ,
260
+ execFileSync ( 'node' , [
260
261
path . join ( RN_ROOT , 'scripts' , 'generate-specs-cli.js' ) ,
261
262
'--platform' ,
262
263
'ios' ,
@@ -266,13 +267,17 @@ function main(appRootDir, outputPath) {
266
267
pathToTempOutputDir ,
267
268
'--libraryName' ,
268
269
library . config . name ,
269
- libraryTypeArg ,
270
- ) ; // ]TODO(macOS GH#774)
270
+ ... libraryTypeArg ,
271
+ ] ) ; // ]TODO(macOS GH#774)
271
272
272
273
// Finally, copy artifacts to the final output directory.
273
274
fs . mkdirSync ( pathToOutputDirIOS , { recursive : true } ) ;
274
275
// [TODO(macOS GH#774) - use execFileSync to help keep shell commands clean
275
- execFileSync ( 'cp' , '-R' , `${ pathToTempOutputDir } /*` , pathToOutputDirIOS ) ; // ]TODO(macOS GH#774)
276
+ execFileSync ( 'cp' , [
277
+ '-R' ,
278
+ path . join ( pathToTempOutputDir , '/' ) ,
279
+ pathToOutputDirIOS ,
280
+ ] ) ; // ]TODO(macOS GH#774)
276
281
console . log ( `[Codegen] Generated artifacts: ${ pathToOutputDirIOS } ` ) ;
277
282
278
283
// Filter the react native core library out.
@@ -295,16 +300,15 @@ function main(appRootDir, outputPath) {
295
300
// Generate FabricComponentProvider.
296
301
// Only for iOS at this moment.
297
302
// [TODO(macOS GH#774) - use execFileSync to help keep shell commands clean
298
- execFileSync (
299
- 'node' ,
303
+ execFileSync ( 'node' , [
300
304
path . join ( RN_ROOT , 'scripts' , 'generate-provider-cli.js' ) ,
301
305
'--platform' ,
302
306
'ios' ,
303
- '--schemaListPast ' ,
307
+ '--schemaListPath ' ,
304
308
schemaListTmpPath ,
305
309
'--outputDir' ,
306
310
iosOutputDir ,
307
- ) ; // ]TODO(macOS GH#774)
311
+ ] ) ; // ]TODO(macOS GH#774)
308
312
console . log ( `Generated provider in: ${ iosOutputDir } ` ) ;
309
313
}
310
314
} catch ( err ) {
0 commit comments