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.
Jan Kassens committed
Mar 26, 2024 at 12:13 UTC
95319ab5afd384f5858f7c080573b9736e6b2f9c
1 file changed
+2
-6
scripts/rollup/build-all-release-channels.js
+2
-6
@@ -158,18 +158,16 @@ function processStable(buildDir) {
158
}
159
160
if (fs.existsSync(buildDir + '/facebook-www')) {
161
- const hash = crypto.createHash('sha1');
161
for (const fileName of fs.readdirSync(buildDir + '/facebook-www').sort()) {
162
const filePath = buildDir + '/facebook-www/' + fileName;
163
const stats = fs.statSync(filePath);
164
if (!stats.isDirectory()) {
166
- hash.update(fs.readFileSync(filePath));
165
fs.renameSync(filePath, filePath.replace('.js', '.classic.js'));
166
}
167
}
168
updatePlaceholderReactVersionInCompiledArtifacts(
169
buildDir + '/facebook-www',
172
- ReactVersion + '-www-classic-' + hash.digest('hex').slice(0, 8)
170
+ ReactVersion + '-www-classic-%FILEHASH%'
171
);
172
}
173
@@ -224,18 +222,16 @@ function processExperimental(buildDir, version) {
222
}
223
224
if (fs.existsSync(buildDir + '/facebook-www')) {
227
- const hash = crypto.createHash('sha1');
225
for (const fileName of fs.readdirSync(buildDir + '/facebook-www').sort()) {
226
const filePath = buildDir + '/facebook-www/' + fileName;
227
const stats = fs.statSync(filePath);
228
if (!stats.isDirectory()) {
232
- hash.update(fs.readFileSync(filePath));
229
fs.renameSync(filePath, filePath.replace('.js', '.modern.js'));
230
}
231
}
232
updatePlaceholderReactVersionInCompiledArtifacts(
233
buildDir + '/facebook-www',
238
- ReactVersion + '-www-modern-' + hash.digest('hex').slice(0, 8)
234
+ ReactVersion + '-www-modern-%FILEHASH%'
235
);
236
}
237