Skip to content

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

Description

@fuleinist

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

Scope

Read-only validation that reports findings without modifying any files. No changes to existing upgrade behavior.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions