nx: nx migrate @angular/core doesn't update all packages
Current Behavior
running nx migrate @angular/coreonly updates package.json for @angular/core and not for all other @angular packages
Expected Behavior
The behavior should be the same as when calling ng update @angular/core
Environment
Node : 14.16.0 OS : darwin x64 npm : 6.14.11
nx : Not Found @nrwl/angular : 12.2.0 @nrwl/cli : 12.2.0 @nrwl/cypress : 12.2.0 @nrwl/devkit : 12.2.0 @nrwl/eslint-plugin-nx : 12.2.0 @nrwl/express : Not Found @nrwl/jest : 12.2.0 @nrwl/linter : 12.2.0 @nrwl/nest : 12.2.0 @nrwl/next : Not Found @nrwl/node : 12.2.0 @nrwl/react : Not Found @nrwl/schematics : Not Found @nrwl/tao : 12.2.0 @nrwl/web : 12.2.0 @nrwl/workspace : 12.2.0 @nrwl/storybook : Not Found @nrwl/gatsby : Not Found typescript : 4.1.5
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Reactions: 18
- Comments: 19 (1 by maintainers)
Before:
After:
And it’s much slower as well as you have to wait for each run separately. As I said in Slack it would at least help if you could run them in a single command:
Or support something like:
The workaround is just:
Same happens for
nx migrate latest. As far as I can tell it does not update any other packages (even @nrwl ones) as long as the @nrwl/workspace package is already up to date. I tested that by manually downgrading @nrwl/workspace and then runningyarn nx migrate latest. And voila, all related packages are now actually checked for the latest version.Output before with @nrwl/workspace@12.9.0
Output after downgrade of only @nrwl/workspace to @12.7.2
Output after downgrade of only @nrwl/workspace and @nrwl/angular to @12.7.2
So it also seems like when any package in the list fulfills the version held by nx, the update process just stops.
Not sure if somehow the way dependency update work has changed, but documentation should also be updated in that case. Because currently it does say:
Which obviously does not seem to be the case anymore. But as Nx still acts as a wrapper, it should in my opinion actually update all dependencies. Or at least it should give an option to force update check on all dependencies.
If my findings are not related to this issue, please to tell me, as I would create a separate issue for this then.
So I guess the real workaround is this snippet:
Then get a coffee… or two
Does not work for me unfortunately
migrated all Nx deps from
15.0.0to15.7.0, ran a bunch of migrations but completely ignored that I am on Angular 14However, running
nx migrate @angular/clicore, etc. updates the deps, adds migrations but some fail due to a migration setup error (probably because there’s no angular.json anymore?)Anything I can do about this?
Update: Found something here https://nx.dev/recipes/other/advanced-update#updating-dependencies-that-are-behind-the-versions-nx-manages
did the trick for me
This is now supported! 🎉
I quite literally changed the version inside package.json to 12.7.2, did
yarn installand then startedyarn nx migrate latest. Although I did notice, that this would of course only update whatever their dependency tree is and nothing further 😞Generally yarn and ng themselves seem to discourage full dependency updates, so that might be one reason. It would probably be best to wait for the aforementioned feature ticket to be resolved.
Just saw this has been heavily requested for a while now. They created a feature request for it earlier this year (#4575), but nothing has happened yet.