From 95319ab5afd384f5858f7c080573b9736e6b2f9c Mon Sep 17 00:00:00 2001 From: Jan Kassens Date: Tue, 26 Mar 2024 12:13:46 -0400 Subject: [PATCH] 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. --- scripts/rollup/build-all-release-channels.js | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/scripts/rollup/build-all-release-channels.js b/scripts/rollup/build-all-release-channels.js index a365faa7e9323..098177baf9a86 100644 --- a/scripts/rollup/build-all-release-channels.js +++ b/scripts/rollup/build-all-release-channels.js @@ -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%' ); }