@@ -173,17 +173,25 @@ function processStable(buildDir) {
173
173
) ;
174
174
}
175
175
176
- [
177
- buildDir + '/react-native/implementations/' ,
178
- buildDir + '/facebook-react-native/' ,
179
- ] . forEach ( reactNativeBuildDir => {
180
- if ( fs . existsSync ( reactNativeBuildDir ) ) {
181
- updatePlaceholderReactVersionInCompiledArtifacts (
182
- reactNativeBuildDir ,
183
- ReactVersion + '-' + canaryChannelLabel + '-%FILEHASH%'
184
- ) ;
176
+ const reactNativeBuildDir = buildDir + '/react-native/implementations/' ;
177
+ if ( fs . existsSync ( reactNativeBuildDir ) ) {
178
+ const hash = crypto . createHash ( 'sha1' ) ;
179
+ for ( const fileName of fs . readdirSync ( reactNativeBuildDir ) . sort ( ) ) {
180
+ const filePath = reactNativeBuildDir + fileName ;
181
+ const stats = fs . statSync ( filePath ) ;
182
+ if ( ! stats . isDirectory ( ) ) {
183
+ hash . update ( fs . readFileSync ( filePath ) ) ;
184
+ }
185
185
}
186
- } ) ;
186
+ updatePlaceholderReactVersionInCompiledArtifacts (
187
+ reactNativeBuildDir ,
188
+ ReactVersion +
189
+ '-' +
190
+ canaryChannelLabel +
191
+ '-' +
192
+ hash . digest ( 'hex' ) . slice ( 0 , 8 )
193
+ ) ;
194
+ }
187
195
188
196
// Update remaining placeholders with canary channel version
189
197
updatePlaceholderReactVersionInCompiledArtifacts (
@@ -354,11 +362,9 @@ function updatePlaceholderReactVersionInCompiledArtifacts(
354
362
355
363
for ( const artifactFilename of artifactFilenames ) {
356
364
const originalText = fs . readFileSync ( artifactFilename , 'utf8' ) ;
357
- const fileHash = crypto . createHash ( 'sha1' ) ;
358
- fileHash . update ( originalText ) ;
359
365
const replacedText = originalText . replaceAll (
360
366
PLACEHOLDER_REACT_VERSION ,
361
- newVersion . replace ( / % F I L E H A S H % / g , fileHash . digest ( 'hex' ) . slice ( 0 , 8 ) )
367
+ newVersion
362
368
) ;
363
369
fs . writeFileSync ( artifactFilename , replacedText ) ;
364
370
}
0 commit comments