@@ -173,17 +173,25 @@ function processStable(buildDir) {
173173 ) ;
174174 }
175175
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+ }
185185 }
186- } ) ;
186+ updatePlaceholderReactVersionInCompiledArtifacts (
187+ reactNativeBuildDir ,
188+ ReactVersion +
189+ '-' +
190+ canaryChannelLabel +
191+ '-' +
192+ hash . digest ( 'hex' ) . slice ( 0 , 8 )
193+ ) ;
194+ }
187195
188196 // Update remaining placeholders with canary channel version
189197 updatePlaceholderReactVersionInCompiledArtifacts (
@@ -354,11 +362,9 @@ function updatePlaceholderReactVersionInCompiledArtifacts(
354362
355363 for ( const artifactFilename of artifactFilenames ) {
356364 const originalText = fs . readFileSync ( artifactFilename , 'utf8' ) ;
357- const fileHash = crypto . createHash ( 'sha1' ) ;
358- fileHash . update ( originalText ) ;
359365 const replacedText = originalText . replaceAll (
360366 PLACEHOLDER_REACT_VERSION ,
361- newVersion . replace ( / % F I L E H A S H % / g , fileHash . digest ( 'hex' ) . slice ( 0 , 8 ) )
367+ newVersion
362368 ) ;
363369 fs . writeFileSync ( artifactFilename , replacedText ) ;
364370 }
0 commit comments