-
Notifications
You must be signed in to change notification settings - Fork 950
feat(upgrade): Add --check flag to pre-validate upgrade compatibility before running #2818
Description
Problem
Running
px @react-native-community/cli upgrade\ to upgrade a React Native project can fail midway through, leaving the project in a broken state. Developers have no way to know if their project is upgrade-compatible until they run the full command.
Proposal
Add a --check\ (or --dry-run) flag to the upgrade command:
\\�ash
npx @react-native-community/cli upgrade --check 0.76.5
or
npx @react-native-community/cli upgrade --dry-run 0.76.5
\\
This would:
- Validate that the target version exists on npm
- Check the project's current dependencies against known breaking changes in the target version
- Detect incompatible native modules (e.g., autolinking issues, native code that won't compile with the new RN version)
- Report what files would be modified and what migration steps would be required
- Not actually modify any files
Why this matters
- Upgrading React Native is risky — breaking changes in native code can cause hours of debugging
- A pre-check gives developers a safe way to evaluate upgrade effort before committing
- Existing tools like Expo's \expo doctor\ provide upgrade compatibility checks; bringing this to the CLI would help bare React Native projects too
- Reduces the number of failed upgrades that leave projects in broken states
Example output
\
$ npx @react-native-community/cli upgrade --check 0.76.5
✔ Validated target version 0.76.5
✔ autolinking: all native modules compatible
⚠ Breaking change: New Architecture is now the default in 0.76.5
- Current project uses Old Architecture
- Migration guide: https://reactnative.dev/docs/new-architecture-introduction
⚠ Known issue: Some native modules may require updates (see: @react-native-community/cli-platform-android cannot building android #2720 )
📝 Files that would be modified: - package.json (update react-native version)
- ios/Podfile (update RN pod references)
- android/app/build.gradle (update compileSdkVersion)
✔ Run upgrade without --check to proceed
\\
Scope
Read-only validation that reports findings without modifying any files. No changes to existing upgrade behavior.