Skip to content

fix(@angular/cli): fallback to deprecated versions when resolving ranges if no non-deprecated version is found (20.3.x)#33355

Merged
alan-agius4 merged 1 commit into
angular:20.3.xfrom
alan-agius4:update-20.3.x
Jun 11, 2026
Merged

fix(@angular/cli): fallback to deprecated versions when resolving ranges if no non-deprecated version is found (20.3.x)#33355
alan-agius4 merged 1 commit into
angular:20.3.xfrom
alan-agius4:update-20.3.x

Conversation

@alan-agius4

Copy link
Copy Markdown
Collaborator

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.

@alan-agius4 alan-agius4 requested a review from clydin June 11, 2026 09:47
@alan-agius4 alan-agius4 added action: review The PR is still awaiting reviews from at least one requested reviewer target: lts This PR is targeting a version currently in long-term support labels Jun 11, 2026

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread packages/angular/cli/src/commands/update/cli.ts
@alan-agius4 alan-agius4 force-pushed the update-20.3.x branch 4 times, most recently from 0d646f8 to a058ba2 Compare June 11, 2026 10:52
…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.
@alan-agius4 alan-agius4 added action: merge The PR is ready for merge by the caretaker and removed action: review The PR is still awaiting reviews from at least one requested reviewer labels Jun 11, 2026
@alan-agius4 alan-agius4 merged commit e3d5646 into angular:20.3.x Jun 11, 2026
31 of 32 checks passed
@alan-agius4

Copy link
Copy Markdown
Collaborator Author

This PR was merged into the repository. The changes were merged into the following branches:

@alan-agius4 alan-agius4 deleted the update-20.3.x branch June 11, 2026 13:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

action: merge The PR is ready for merge by the caretaker area: @angular/cli target: lts This PR is targeting a version currently in long-term support

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants