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-codegen
react-native/@codegen
react-native-gradle-plugin
react-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:
facebook/react-native#36286 (comment)
See here for a build failure generated by wrong gradle plugin version:
facebook/react-native#36198 (comment)