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

doctor: detect wrong app dependencies

Open
#1,848 4 comments 4 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

command: doctor feature request no-stale-bot
Dominant language
TypeScript
Stars
2.9k
Forks
949
PR merge metrics
No merged PRs in 30d

Description

Describe the Feature

I'd like to propose a feature for doctor that will ideally make life easier for users when upgrading RN versions: detect erroneous top level package.

Essentially inside the app package.json file in the dependencies/devDependencies block, we should inspect for packages which are known to be incompatible (an alternative could be to inspect the yarn.lock).

Packages you should not have in your app package.json are:

A more relaxed way to check for those depedencies is to verify if they're compatible with the RN version (so for instance react-native 0.71.x works only with react-native-codegen version 0.71.x and so on).

In general, there is no reason why a user should directly depend on a package like react-native/@gradle-plugin. What happens is that users find a (generally wrong) workaround somewhere on Github/StackOverflow, and this dependency ends up in their package.json causing future react-native version upgrades to fail badly.

Related Issues

See here for a build failure generated by wrong codegen version:
https://github.com/facebook/react-native/issues/36286#issuecomment-1446323061

See here for a build failure generated by wrong gradle plugin version:
https://github.com/facebook/react-native/issues/36198#issuecomment-1436906763

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 with the doctor command and the app package.json dependencies and devDependencies mentioned in the issue. Review how the CLI currently inspects project dependencies, then determine how the listed React Native packages should be detected and reported; done means erroneous top-level dependencies are identified with a useful message. Consider the alternative yarn.lock check and the package list under the React Native packages directory.

Written by the indexing model from the issue text.

Assessment

Tech stack
react-native, typescript
Domain
cli, mobile
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.