-
Notifications
You must be signed in to change notification settings - Fork 46.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Build: use content hash for facebook-react-native build #27577
Conversation
Comparing: 960ed6e...f5a2de5 Critical size changesIncludes critical production bundles, as well as any change greater than 2%:
Significant size changesIncludes any change greater than 0.2%: (No significant changes) |
function hashJSFilesInDirectory(directory) { | ||
const hash = crypto.createHash('sha1'); | ||
for (const filePath of glob.sync(directory + '/**/*.js').sort()) { | ||
hash.update(fs.readFileSync(filePath)); | ||
} | ||
return hash.digest('hex').slice(0, 8); | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we hash based on only JS files? Not important now, but hashing on non-directories seems more reliable, in case we will distribute non-js files at some point
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm actually not sure if we even need this version string anyway? I think devtools use them in some capacity, but I'm not sure what the exact requirements are.
nice! thanks for doing this |
…)" This reverts commit 51ffd35.
) Reverts #27577. We also sync React Native OSS bundles which means this didn't work as hoped unless we abandon the commit hash in OSS which seems useful.
React upstream changes: - facebook/react#27586 - facebook/react#27577 - facebook/react#27576 Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
…584) Reverts facebook/react#27577. We also sync React Native OSS bundles which means this didn't work as hoped unless we abandon the commit hash in OSS which seems useful. DiffTrain build for [97047a810cb19e3041a3ec163f4fde85f495bdc1](facebook/react@97047a8)
Similar to facebook#26734, this switches the RN builds for Meta to a content hash instead of git commit number to make the builds reproducible and avoid creating sync commits if the bundled content didn't change.
…ebook#27584) Reverts facebook#27577. We also sync React Native OSS bundles which means this didn't work as hoped unless we abandon the commit hash in OSS which seems useful.
Similar to #26734, this switches the RN builds for Meta to a content hash instead of git commit number to make the builds reproducible and avoid creating sync commits if the bundled content didn't change.