Simplified native dependency tracking for React Native
source link: https://reactnativeexample.com/simplified-native-dependency-tracking-for-react-native/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
rn-native-hash – Simplified native dependency tracking for React Native
rn-native-hash
strives to make it easier to keep track of when the native dependencies of a React Native (or Expo) project has changed. It does so by (1) detecting native modules in node_modules and (2) generating a hash based on those package names and versions. It provides three commands:
- generate – Generates a hash and by default saves it in
.rn-native-hashrc
. Can optionally save it in package.json (with -p) or update releaseChannels for eas builds (with -e). - verify – Checks whether the hash has changed compared to
.rn-native-hashrc
or package.json. - list – Lists all native dependencies and the resulting hash
- hash – Just returns the hash for easy piping
Recipes
Keep up to date
Run rn-native-hash
on postinstall
to always keep it up to date:
{ "scripts": { "postinstall": "rn-native-hash generate" } }
OTA updates / Expo release channels
Use one release channel per hash to get predictability in your OTA updates.
expo publish --release-channel `rn-native-hash hash`
expo publish --release-channel `cat .rn-native-hashrc`
Generate a new Native Client when native dependencies has changed
Generate new native builds automatically when it’s needed.
Native Module Detection
We detect native modules by looking for ios
and/or android
folders in each package. Please post an issue (PRs are welcome 🙂 for any false positives/negatives you might find!
GitHub
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK