I have a monorepo with this kind of structure :
root
├ .git
├ mobile
| ├ android
| ├ app
| ├ ios
| ├ ...
├ server
â”” web
react-native upgrade does nothing when I run it from my app's folder (mobile) because it tries to apply the patch at the root of the git repo (I guess).
Anyways I managed to upgrade manually with git --apply ... --directory="mobile" but there have to be other people expecting this to work out of the box, given that it did with the legacy react-native-git-upgrade.
Would you like to send a PR with a fix for that? :)
I'm looking into it right now, especially how to test it...
@maxaggedon I think that not only the upgrade is not working, the init does not work too.. (I've linked the issue above)
@thymikee
I was trying to find the matching cli code from my local machine:
var CLI_MODULE_PATH = function() {
return path.resolve(
process.cwd(),
'node_modules',
'react-native',
'cli.js'
);
};
var REACT_NATIVE_PACKAGE_JSON_PATH = function() {
return path.resolve(
process.cwd(),
'node_modules',
'react-native',
'package.json'
);
};
I couldn't find it here on the repo.. but i found this code that may be the updated version:
https://github.com/react-native-community/react-native-cli/blob/6a5e6e6b43917a6ef67b4763fc9480b6faf4fb2e/packages/cli/src/cliEntry.js#L166-L185
So i thought that I was using the wrong cli version, but i'm on the last published in the npm repo (2.0.1), and looking on the global-cli version, the 2.0.2 isn't published yet.. perhaps the init problem is fixed and not published yet?
@Grohden the @react-native-community/cli itself is not meant to be used as a direct dependency on your project. You should only use the CLI that comes with react-native as _its_ dependency. So you should be on 1.x now if you use RN 0.59. If you're below that, the CLI is still bundled inside RN core repo: https://github.com/facebook/react-native/tree/0.58-stable/local-cli and https://github.com/facebook/react-native/tree/0.58-stable/react-native-cli
Since this is totally different use case than upgrading, can you please create a new issue with explicitly specifying what you expect?
@thymikee done
is this supposed to be working? I'm just playing with a blank rn 63,3 in a monorepo
info Installing "[email protected]" and its peer dependencies...
error Command failed: yarn add [email protected] [email protected]
error Running this command will add the dependency to the workspace root rather than the workspace itself, which might not be what you want - if you really meant it, make it explicit by running this command again with the -W flag (or --ignore-workspace-root-check).
yarn add v1.22.10
@yepes this issue was about supporting a monorepo folder structure, your error seems to be more about using yarn workspaces.
Anyway I don't use this command anymore to upgrade but prefer doing it manually while refering to :
Should there be another issue like
upgradedoes not work with yarn workspaces
or should this one be reopened?
@buschco my opinion is that a new issue should be created to track those new use cases with yarn workspaces, as it's a (related but) different situation and this issue is quite old and fixed.