fix(@angular/cli): fallback to deprecated versions when resolving ranges if no non-deprecated version is found (20.3.x) - #33355
Conversation
There was a problem hiding this comment.
Code Review
This pull request updates the package version selection logic for the 'range' case in the Angular CLI update command, allowing it to fall back to deprecated versions if no non-deprecated versions satisfy the requested semver range. The review feedback suggests optimizing this implementation to avoid multiple array allocations and iterations by tracking both the latest non-deprecated and deprecated versions in a single pass.
0d646f8 to
a058ba2
Compare
…ges if no non-deprecated version is found When using ng update to resolve package version ranges on the command line in 20.3.x, we previously skipped deprecated package versions entirely during pre-validation. In cases where all versions satisfying the range are deprecated, this resulted in update failure. Now, we attempt to find a satisfying version from non-deprecated versions first, and fallback to deprecated versions if none are found. This aligns the CLI pre-validation with the update schematic resolution logic. Additionally, in the update schematic, we align package group versions to the resolved version of the group leader instead of using the unresolved range, and we remove the check that prevented aligning already-present packages. This ensures that when a package in the group (like @angular/animations) is deprecated, it is correctly aligned with the other group members, preventing peer dependency conflicts during update.
a058ba2 to
b455a67
Compare
|
This PR was merged into the repository. The changes were merged into the following branches:
|
|
This pull request has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
When using
ng updateto resolve package version ranges on the command line in 20.3.x, we previously skipped deprecated package versions entirely during pre-validation. In cases where all versions satisfying the range are deprecated, this resulted in update failure. Now, we attempt to find a satisfying version from non-deprecated versions first, and fallback to deprecated versions if none are found. This aligns the CLI pre-validation with the update schematic resolution logic.