Skip to content
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

refactor(cli): only add react and react-native when missing in prebuild #22624

Merged
merged 3 commits into from Jun 12, 2023

Conversation

byCedric
Copy link
Member

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 and react-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 and react-native are defined as exact versions in the templates).

Note, that this still bumps expo and expo-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
  • Modify the React / React Native version to a lower patch/minor bump
  • $ yarn expo prebuild
  • This should warn with using current versions instead of the recommended react@<version>, react-native@<version>, it should not change the versions anymore.

Checklist

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.
@byCedric byCedric requested a review from brentvatne May 23, 2023 15:02
@byCedric byCedric requested a review from EvanBacon as a code owner May 23, 2023 15:02
@linear
Copy link

linear bot commented May 23, 2023

ENG-8480 Prebuild: stop modifying project dependencies

Starting with SDK 49, let's leave the react, react-native, and any other dependencies unchanged by default when running prebuild. Changing this versions during prebuild will occasionally break EAS Build for developers who using monorepos and miss out on doing a React Native version bump (and we often bump the patch version during an SDK cycle, so this can happen often).

@byCedric byCedric changed the title refactor(cli): only add react and react-native when missing refactor(cli): only add react and react-native when missing in prebuild May 23, 2023
@expo-bot expo-bot added the bot: suggestions ExpoBot has some suggestions label May 23, 2023
@expo-bot expo-bot added bot: passed checks ExpoBot has nothing to complain about and removed bot: suggestions ExpoBot has some suggestions labels May 23, 2023
@byCedric byCedric merged commit 624497a into main Jun 12, 2023
4 of 5 checks passed
@byCedric byCedric deleted the @bycedric/cli/limit-prebuild-dependency-changes branch June 12, 2023 17:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bot: passed checks ExpoBot has nothing to complain about
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants