Closed mirobo closed 10 months ago
Thanks for reporting this!
The nx migrate
command will only update packages if there's a defined package update for them in the Nx plugin that manages them and that package update hasn't been applied yet. In your particular case, the @nx/angular
plugin is the one that manages Angular packages, and you're already in an Nx version where all package updates were applied. Note I'm referring here to Nx-defined package updates. The last package update defined in the @nx/angular
plugin is for Nx v17.1.0. Since you're already on a newer version, that package update is assumed as applied and it's not run again.
We normally don't have specific package updates for patch versions. The Angular plugin manages migrations for each minor and only when there's a critical fix in a patch version that we want to force workspaces out there to get it, we have a package update for it. At the time of updating for the first time to a given version, you do get migrated to the last patch version available, but after that, most of the time the next migration that will be available will be for the next minor version.
In cases like this where the @nx/angular
plugin doesn't have a package update for a patch version, you can manually update those patch versions. Please note this is only fine if you're only bumping a patch version. For minor or major versions you must wait for the @nx/angular
plugin to support it.
@leosvelperez Thanks, I'll incorporate this knowledge into our pipeline (and probably just run additional commands to update to the latest patches of Angular for the time being). The latest patch contains a bugfix for Tailwind @screen
directive. Without it, any NX/Angular project would fail when switching to ESBuild. I know it's hard to keep up with even the minor updates for a tool like NX.
But maybe it's worth to think of an option for a command like nx patch angular|react
which would update to the latest patch version (which generally wouldn't require migrations).
Based on the code here https://github.com/nrwl/nx/blob/master/scripts/angular-support-upgrades/init-upgrade.ts (which is for internal use only I guess?) it shouldn't be that hard (I can get the latest patch version via https://registry.npmjs.org/@angular/core/17.0.x
).
Otherwise I have options like:
Not sure if you have insight on how many users update patch versions manually but right now it seems like a hassle because I can't run all updates at once with nx migrate @angular/core@17.0.8 @angular/cli@17.0.8 ..
it would only update the first package anyway. Generally I think it would be very handy to have more granular control over the updates (without the need for a custom solution which everybody eventually develops for themselves).
I this something that could be contributed? Or is it strictly out-of-scope?
@mirobo we're not planning to do something like that anytime soon. Patch versions don't require migrations, so it's only a matter of updating the package versions. The script you mentioned is effectively for internal use and it's only a helper script to generate some boilerplate needed for supporting a new version of Angular in our plugin. You can have a simpler variation of it that only updates your packages to the latest or a given patch version.
This issue has been closed for more than 30 days. If this issue is still occuring, please open a new issue with more recent context.
Current Behavior
See older issue https://github.com/nrwl/nx/issues/17100
I have a project with Angular 17.0.2 and NX 17.2.8 and when I run
nx migrate latest
it doesn't update Angular/Angular Devkit/Schematics to version 17.0.8 (latest patch)Expected Behavior
nx migrate latest
should update Angular dependencies such as@angular/core
,@angular/cli
,@schematics/angular
,@angular-devkit/core
to their latest patch versionGitHub Repo
No response
Steps to Reproduce
Run
nx migrate latest
in a project with Angular 17.0.2 and see how it is not updatedNx Report
Failure Logs
No response
Package Manager Version
No response
Operating System
Additional Information
No response