Skip to content

Commit 25f9c80

Browse files
committed
Fix
1 parent 883716d commit 25f9c80

File tree

1 file changed

+32
-4
lines changed

1 file changed

+32
-4
lines changed

scripts/rollup/build-all-release-channels.js

Lines changed: 32 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -178,8 +178,8 @@ function processStable(buildDir) {
178178
}
179179

180180
if (fs.existsSync(buildDir + '/react-native')) {
181-
updatePlaceholderReactVersionInCompiledArtifacts(
182-
buildDir + '/react-native/implementations/**.fb.js',
181+
updatePlaceholderReactVersionInCompiledArtifactsFb(
182+
buildDir + '/react-native',
183183
rnVersionString
184184
);
185185
}
@@ -287,8 +287,8 @@ function processExperimental(buildDir, version) {
287287
}
288288

289289
if (fs.existsSync(buildDir + '/react-native')) {
290-
updatePlaceholderReactVersionInCompiledArtifacts(
291-
buildDir + '/react-native/implementations/**.fb.js',
290+
updatePlaceholderReactVersionInCompiledArtifactsFb(
291+
buildDir + '/react-native',
292292
rnVersionString
293293
);
294294
}
@@ -410,6 +410,34 @@ function updatePlaceholderReactVersionInCompiledArtifacts(
410410
}
411411
}
412412

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+
413441
/**
414442
* cross-platform alternative to `rsync -ar`
415443
* @param {string} source

0 commit comments

Comments
 (0)