refactor(cli): only add react
and react-native
when missing in prebuild
#22624
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Why
Fixes ENG-8480
This prevents accidental overwrites during
expo prebuild
. It's particularly painful in monorepos where users might want to use a specific react-native version, and not use the patch update.How
Marked both
react
andreact-native
as "add when missing" packages. Meaning that if it's not defined, we still add it. But once it's defined, we only warn when the semver range DOES NOT intersect (react
andreact-native
are defined as exact versions in the templates).Note, that this still bumps
expo
andexpo-splash-screen
, which I think makes sense due to us releasing patch fixes regularly. But we can opt into fully disabling any bumps during prebuild in general.Test Plan
See added tests, and:
$ yarn create expo ./test-app && cd ./test-app
$ yarn expo prebuild
using current versions instead of the recommended react@<version>, react-native@<version>
, it should not change the versions anymore.Checklist
npx expo prebuild
& EAS Build (eg: updated a module plugin).