@@ -178,8 +178,8 @@ function processStable(buildDir) {
178
178
}
179
179
180
180
if ( fs . existsSync ( buildDir + '/react-native' ) ) {
181
- updatePlaceholderReactVersionInCompiledArtifacts (
182
- buildDir + '/react-native/implementations/**.fb.js ' ,
181
+ updatePlaceholderReactVersionInCompiledArtifactsFb (
182
+ buildDir + '/react-native' ,
183
183
rnVersionString
184
184
) ;
185
185
}
@@ -287,8 +287,8 @@ function processExperimental(buildDir, version) {
287
287
}
288
288
289
289
if ( fs . existsSync ( buildDir + '/react-native' ) ) {
290
- updatePlaceholderReactVersionInCompiledArtifacts (
291
- buildDir + '/react-native/implementations/**.fb.js ' ,
290
+ updatePlaceholderReactVersionInCompiledArtifactsFb (
291
+ buildDir + '/react-native' ,
292
292
rnVersionString
293
293
) ;
294
294
}
@@ -410,6 +410,34 @@ function updatePlaceholderReactVersionInCompiledArtifacts(
410
410
}
411
411
}
412
412
413
+ function updatePlaceholderReactVersionInCompiledArtifactsFb (
414
+ artifactsDirectory ,
415
+ newVersion
416
+ ) {
417
+ // Update the version of React in the compiled artifacts by searching for
418
+ // the placeholder string and replacing it with a new one.
419
+ const artifactFilenames = String (
420
+ spawnSync ( 'grep' , [
421
+ '-lr' ,
422
+ PLACEHOLDER_REACT_VERSION ,
423
+ '--' ,
424
+ artifactsDirectory ,
425
+ ] ) . stdout
426
+ )
427
+ . trim ( )
428
+ . split ( '\n' )
429
+ . filter ( filename => filename . endsWith ( '.fb.js' ) ) ;
430
+
431
+ for ( const artifactFilename of artifactFilenames ) {
432
+ const originalText = fs . readFileSync ( artifactFilename , 'utf8' ) ;
433
+ const replacedText = originalText . replaceAll (
434
+ PLACEHOLDER_REACT_VERSION ,
435
+ newVersion
436
+ ) ;
437
+ fs . writeFileSync ( artifactFilename , replacedText ) ;
438
+ }
439
+ }
440
+
413
441
/**
414
442
* cross-platform alternative to `rsync -ar`
415
443
* @param {string } source
0 commit comments