react-native-community / react-native-community/cli

feat(upgrade): Add --check flag to pre-validate upgrade compatibility before running

Open
#2,818 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
2.9k
Forks
949
PR merge metrics
No merged PRs in 30d

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:

  1. Validate that the target version exists on npm
  2. Check the project's current dependencies against known breaking changes in the target version
  3. Detect incompatible native modules (e.g., autolinking issues, native code that won't compile with the new RN version)
  4. Report what files would be modified and what migration steps would be required
  5. 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: #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.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the CLI upgrade command entry point and its existing validation and migration flow. Define the read-only checks for the target version, dependencies, native modules, and projected file changes, then add coverage for the --check behavior. Done means the command reports findings without modifying project files and leaves normal upgrades unchanged.

Written by the indexing model from the issue text.

Assessment

Tech stack
react-native, typescript
Domain
cli, mobile-dev
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.