Switch facebook-www build version to file content hash (#28633)

Unifies the React version string pattern with RN just to simplify the
build script a tiny bit and not have 2 mechanisms for the Meta-internal
build.
This commit is contained in:
Jan Kassens
2024-03-26 12:13:46 -04:00
committed by GitHub
parent 0c5c25e38a
commit 80b7ef781b
+2 -6
View File
@@ -158,18 +158,16 @@ function processStable(buildDir) {
}
if (fs.existsSync(buildDir + '/facebook-www')) {
const hash = crypto.createHash('sha1');
for (const fileName of fs.readdirSync(buildDir + '/facebook-www').sort()) {
const filePath = buildDir + '/facebook-www/' + fileName;
const stats = fs.statSync(filePath);
if (!stats.isDirectory()) {
hash.update(fs.readFileSync(filePath));
fs.renameSync(filePath, filePath.replace('.js', '.classic.js'));
}
}
updatePlaceholderReactVersionInCompiledArtifacts(
buildDir + '/facebook-www',
ReactVersion + '-www-classic-' + hash.digest('hex').slice(0, 8)
ReactVersion + '-www-classic-%FILEHASH%'
);
}
@@ -224,18 +222,16 @@ function processExperimental(buildDir, version) {
}
if (fs.existsSync(buildDir + '/facebook-www')) {
const hash = crypto.createHash('sha1');
for (const fileName of fs.readdirSync(buildDir + '/facebook-www').sort()) {
const filePath = buildDir + '/facebook-www/' + fileName;
const stats = fs.statSync(filePath);
if (!stats.isDirectory()) {
hash.update(fs.readFileSync(filePath));
fs.renameSync(filePath, filePath.replace('.js', '.modern.js'));
}
}
updatePlaceholderReactVersionInCompiledArtifacts(
buildDir + '/facebook-www',
ReactVersion + '-www-modern-' + hash.digest('hex').slice(0, 8)
ReactVersion + '-www-modern-%FILEHASH%'
);
}