mirror of
https://github.com/hanzoai/react.git
synced 2026-09-24 17:02:27 +00:00
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:
@@ -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%'
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user