16
16
* in a CODEGEN_CONFIG_FILENAME file.
17
17
*/
18
18
19
- const { execSync} = require ( 'child_process' ) ;
19
+ const { execSync, execFileSync } = require ( 'child_process' ) ;
20
20
const fs = require ( 'fs' ) ;
21
21
const os = require ( 'os' ) ;
22
22
const path = require ( 'path' ) ;
@@ -234,35 +234,45 @@ function main(appRootDir, outputPath) {
234
234
235
235
console . log ( `\n\n[Codegen] >>>>> Processing ${ library . config . name } ` ) ;
236
236
// Generate one schema for the entire library...
237
- execSync (
238
- `node ${ path . join (
237
+ // [TODO(macOS GH#774) - use execFileSync to help keep shell commands clean
238
+ execFileSync (
239
+ 'node' ,
240
+ path . join (
239
241
codegenCliPath ,
240
242
'lib' ,
241
243
'cli' ,
242
244
'combine' ,
243
245
'combine-js-to-schema-cli.js' ,
244
- ) } ${ pathToSchema } ${ pathToJavaScriptSources } `,
245
- ) ;
246
+ ) ,
247
+ pathToSchema ,
248
+ pathToJavaScriptSources ,
249
+ ) ; // ]TODO(macOS GH#774)
246
250
console . log ( `[Codegen] Generated schema: ${ pathToSchema } ` ) ;
247
251
248
252
// ...then generate native code artifacts.
249
253
const libraryTypeArg = library . config . type
250
254
? `--libraryType ${ library . config . type } `
251
255
: '' ;
252
256
fs . mkdirSync ( pathToTempOutputDir , { recursive : true } ) ;
253
- execSync (
254
- `node ${ path . join (
255
- RN_ROOT ,
256
- 'scripts' ,
257
- 'generate-specs-cli.js' ,
258
- ) } --platform ios --schemaPath ${ pathToSchema } --outputDir ${ pathToTempOutputDir } --libraryName ${
259
- library . config . name
260
- } ${ libraryTypeArg } `,
261
- ) ;
257
+ // [TODO(macOS GH#774) - use execFileSync to help keep shell commands clean
258
+ execFileSync (
259
+ 'node' ,
260
+ path . join ( RN_ROOT , 'scripts' , 'generate-specs-cli.js' ) ,
261
+ '--platform' ,
262
+ 'ios' ,
263
+ '--schemaPath' ,
264
+ pathToSchema ,
265
+ '--outputDir' ,
266
+ pathToTempOutputDir ,
267
+ '--libraryName' ,
268
+ library . config . name ,
269
+ libraryTypeArg ,
270
+ ) ; // ]TODO(macOS GH#774)
262
271
263
272
// Finally, copy artifacts to the final output directory.
264
273
fs . mkdirSync ( pathToOutputDirIOS , { recursive : true } ) ;
265
- execSync ( `cp -R ${ pathToTempOutputDir } /* ${ pathToOutputDirIOS } ` ) ;
274
+ // [TODO(macOS GH#774) - use execFileSync to help keep shell commands clean
275
+ execFileSync ( 'cp' , '-R' , `${ pathToTempOutputDir } /*` , pathToOutputDirIOS ) ; // ]TODO(macOS GH#774)
266
276
console . log ( `[Codegen] Generated artifacts: ${ pathToOutputDirIOS } ` ) ;
267
277
268
278
// Filter the react native core library out.
@@ -284,13 +294,17 @@ function main(appRootDir, outputPath) {
284
294
285
295
// Generate FabricComponentProvider.
286
296
// Only for iOS at this moment.
287
- execSync (
288
- `node ${ path . join (
289
- RN_ROOT ,
290
- 'scripts' ,
291
- 'generate-provider-cli.js' ,
292
- ) } --platform ios --schemaListPath "${ schemaListTmpPath } " --outputDir ${ iosOutputDir } `,
293
- ) ;
297
+ // [TODO(macOS GH#774) - use execFileSync to help keep shell commands clean
298
+ execFileSync (
299
+ 'node' ,
300
+ path . join ( RN_ROOT , 'scripts' , 'generate-provider-cli.js' ) ,
301
+ '--platform' ,
302
+ 'ios' ,
303
+ '--schemaListPast' ,
304
+ schemaListTmpPath ,
305
+ '--outputDir' ,
306
+ iosOutputDir ,
307
+ ) ; // ]TODO(macOS GH#774)
294
308
console . log ( `Generated provider in: ${ iosOutputDir } ` ) ;
295
309
}
296
310
} catch ( err ) {
0 commit comments