react-native-community / react-native-community/cli
doctor: detect wrong app dependencies
Nobody has claimed this yet.
- 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:
react-native-codegenreact-native/@codegenreact-native-gradle-pluginreact-native/@gradle-plugin- (there might be more by checking the packages here https://github.com/facebook/react-native/tree/main/packages)
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
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- 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