-
Notifications
You must be signed in to change notification settings - Fork 12k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(@angular/cli): logic which determines which temp version of the CLI is to be download during ng update
#22200
fix(@angular/cli): logic which determines which temp version of the CLI is to be download during ng update
#22200
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When updating an
@angular/
or@nguniversal/
and no target version is specified. Example:ng update @angular/core
the update will run on most latest version of the@angular/cli
.
Does ng update @angular/core
go to latest or the next major? If I'm on v10 and run this, it should go to v11 right, since we only allow one major at a time? In that scenario, wouldn't we want to upgrade with the latest patch of the destination major (in this case, @angular/cli@11
)?
When no version is specified the update will use the |
…LI is to be download during `ng update` Previously, when using an older version of the Angular CLI, during `ng update`, we download the temporary `latest` version to run the update. The ensured that when running that the runner used to run the update contains the latest bug fixes and improvements. This however, can be problematic in some cases. Such as when there are API breaking changes, when running a relatively old schematic with the latest CLI can cause runtime issues, especially since those schematics were never meant to be executed on a CLI X major versions in the future. With this change, we improve the logic to determine which version of the Angular CLI should be used to run the update. Below is a summarization of this. - When using the `--next` command line argument, the `@next` version of the CLI will be used to run the update. - When updating an `@angular/` or `@nguniversal/` package, the target version will be used to run the update. Example: `ng update @angular/core@12`, the update will run on most recent patch version of `@angular/cli` of that major version `@12.2.6`. - When updating an `@angular/` or `@nguniversal/` and no target version is specified. Example: `ng update @angular/core` the update will run on most latest version of the `@angular/cli`. - When updating a third-party package, the most recent patch version of the installed `@angular/cli` will be used to run the update. Example if `13.0.0` is installed and `13.1.1` is available on NPM, the latter will be used.
Note: once merged, I will create PRs to backport this change to all LTS versions of the CLI. |
Hmm, I'm a bit torn here. I just tried this with today's logic to make sure I understood and running
So I guess the decision of which CLI runner to use doesn't really matter since the update will fail anyways if |
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
Previously, when using an older version of the Angular CLI, during
ng update
, we download the temporarylatest
version to run the update. The ensured that when running that the runner used to run the update contains the latest bug fixes and improvements.This however, can be problematic in some cases. Such as when there are API breaking changes, when running a relatively old schematic with the latest CLI can cause runtime issues, especially since those schematics were never meant to be executed on a CLI X major versions in the future.
With this change, we improve the logic to determine which version of the Angular CLI should be used to run the update.
Below is a summarization of this.
--next
command line argument, the@next
version of the CLI will be used to run the update.@angular/
or@nguniversal/
package, the target version will be used to run the update. Example:ng update @angular/core@12
, the update will run on most recent patch version of@angular/cli
of that major version@12.2.6
.@angular/
or@nguniversal/
and no target version is specified. Example:ng update @angular/core
the update will run on most latest version of the@angular/cli
.@angular/cli
will be used to run the update. Example if13.0.0
is installed and13.1.1
is available on NPM, the latter will be used.