Skip to content

Commit 3b15879

Browse files
committed
Revert "Change to content hash for RN canary VERSION strings (facebook#28582)"
This reverts commit cb076b5.
1 parent d01ebc8 commit 3b15879

File tree

1 file changed

+19
-13
lines changed

1 file changed

+19
-13
lines changed

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

Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -173,17 +173,25 @@ function processStable(buildDir) {
173173
);
174174
}
175175

176-
[
177-
buildDir + '/react-native/implementations/',
178-
buildDir + '/facebook-react-native/',
179-
].forEach(reactNativeBuildDir => {
180-
if (fs.existsSync(reactNativeBuildDir)) {
181-
updatePlaceholderReactVersionInCompiledArtifacts(
182-
reactNativeBuildDir,
183-
ReactVersion + '-' + canaryChannelLabel + '-%FILEHASH%'
184-
);
176+
const reactNativeBuildDir = buildDir + '/react-native/implementations/';
177+
if (fs.existsSync(reactNativeBuildDir)) {
178+
const hash = crypto.createHash('sha1');
179+
for (const fileName of fs.readdirSync(reactNativeBuildDir).sort()) {
180+
const filePath = reactNativeBuildDir + fileName;
181+
const stats = fs.statSync(filePath);
182+
if (!stats.isDirectory()) {
183+
hash.update(fs.readFileSync(filePath));
184+
}
185185
}
186-
});
186+
updatePlaceholderReactVersionInCompiledArtifacts(
187+
reactNativeBuildDir,
188+
ReactVersion +
189+
'-' +
190+
canaryChannelLabel +
191+
'-' +
192+
hash.digest('hex').slice(0, 8)
193+
);
194+
}
187195

188196
// Update remaining placeholders with canary channel version
189197
updatePlaceholderReactVersionInCompiledArtifacts(
@@ -354,11 +362,9 @@ function updatePlaceholderReactVersionInCompiledArtifacts(
354362

355363
for (const artifactFilename of artifactFilenames) {
356364
const originalText = fs.readFileSync(artifactFilename, 'utf8');
357-
const fileHash = crypto.createHash('sha1');
358-
fileHash.update(originalText);
359365
const replacedText = originalText.replaceAll(
360366
PLACEHOLDER_REACT_VERSION,
361-
newVersion.replace(/%FILEHASH%/g, fileHash.digest('hex').slice(0, 8))
367+
newVersion
362368
);
363369
fs.writeFileSync(artifactFilename, replacedText);
364370
}

0 commit comments

Comments
 (0)