Skip to content

Commit 0b427b0

Browse files
committed
Revert "Switch facebook-www build version to file content hash (facebook#28633)"
This reverts commit 95319ab.
1 parent c2b45ef commit 0b427b0

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

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

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -158,16 +158,18 @@ function processStable(buildDir) {
158158
}
159159

160160
if (fs.existsSync(buildDir + '/facebook-www')) {
161+
const hash = crypto.createHash('sha1');
161162
for (const fileName of fs.readdirSync(buildDir + '/facebook-www').sort()) {
162163
const filePath = buildDir + '/facebook-www/' + fileName;
163164
const stats = fs.statSync(filePath);
164165
if (!stats.isDirectory()) {
166+
hash.update(fs.readFileSync(filePath));
165167
fs.renameSync(filePath, filePath.replace('.js', '.classic.js'));
166168
}
167169
}
168170
updatePlaceholderReactVersionInCompiledArtifacts(
169171
buildDir + '/facebook-www',
170-
ReactVersion + '-www-classic-%FILEHASH%'
172+
ReactVersion + '-www-classic-' + hash.digest('hex').slice(0, 8)
171173
);
172174
}
173175

@@ -222,16 +224,18 @@ function processExperimental(buildDir, version) {
222224
}
223225

224226
if (fs.existsSync(buildDir + '/facebook-www')) {
227+
const hash = crypto.createHash('sha1');
225228
for (const fileName of fs.readdirSync(buildDir + '/facebook-www').sort()) {
226229
const filePath = buildDir + '/facebook-www/' + fileName;
227230
const stats = fs.statSync(filePath);
228231
if (!stats.isDirectory()) {
232+
hash.update(fs.readFileSync(filePath));
229233
fs.renameSync(filePath, filePath.replace('.js', '.modern.js'));
230234
}
231235
}
232236
updatePlaceholderReactVersionInCompiledArtifacts(
233237
buildDir + '/facebook-www',
234-
ReactVersion + '-www-modern-%FILEHASH%'
238+
ReactVersion + '-www-modern-' + hash.digest('hex').slice(0, 8)
235239
);
236240
}
237241

0 commit comments

Comments
 (0)