Skip to content

refactor(@angular/cli): transition update command to use PackageManager abstraction#33364

Open
clydin wants to merge 3 commits into
angular:mainfrom
clydin:refactor-update-package-manager-abstraction
Open

refactor(@angular/cli): transition update command to use PackageManager abstraction#33364
clydin wants to merge 3 commits into
angular:mainfrom
clydin:refactor-update-package-manager-abstraction

Conversation

@clydin

@clydin clydin commented Jun 11, 2026

Copy link
Copy Markdown
Member

Transition the update command's version resolver to utilize the registry methods from the PackageManager abstraction instead of directly querying the registry via pacote.

This introduces a cached RegistryClient wrapper that retrieves package metadata and manifests on-demand. Update resolution helper functions are updated to be asynchronous to support the lazy-loading of registry documents.

Fixes #33119 (Honors minimum-release-age and supply-chain policies)
Fixes #27163 (Enforces project-scoped .npmrc / .yarnrc registry settings)
Fixes #26505 (Yarn Plug'n'Play compatibility)
Fixes #28834 (Gracefully handles private/unpublished packages via local package info)

@clydin clydin force-pushed the refactor-update-package-manager-abstraction branch from 6cdfcbc to 93c2ef7 Compare June 15, 2026 12:35
@clydin clydin marked this pull request as ready for review June 15, 2026 13:15

@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 refactors the update resolution mechanism in the Angular CLI to use a new RegistryClient class for caching package metadata and manifests, while also moving several dependencies (like pacote, ini, and @yarnpkg/lockfile) to the root package.json. The review feedback suggests improving the robustness of the RegistryClient cache by removing rejected promises to prevent cache poisoning, and optimizing performance by parallelizing sequential async operations using Promise.all when building package info and printing update usage messages.

Comment thread packages/angular/cli/src/commands/update/update-resolver.ts
Comment thread packages/angular/cli/src/commands/update/update-resolver.ts
Comment thread packages/angular/cli/src/commands/update/update-resolver.ts Outdated
Comment thread packages/angular/cli/src/commands/update/update-resolver.ts Outdated
@clydin clydin force-pushed the refactor-update-package-manager-abstraction branch 3 times, most recently from dbc0c36 to 9e77dfc Compare June 15, 2026 14:02
@clydin clydin added target: minor This PR is targeted for the next minor release action: review The PR is still awaiting reviews from at least one requested reviewer labels Jun 15, 2026
@clydin clydin requested a review from alan-agius4 June 16, 2026 02:53
Comment thread packages/angular/cli/package.json
@clydin clydin force-pushed the refactor-update-package-manager-abstraction branch 2 times, most recently from 7a65ca5 to 50c1489 Compare June 16, 2026 12:59
@clydin clydin requested a review from alan-agius4 June 16, 2026 13:34

@alan-agius4 alan-agius4 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM, nice work!

@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 17, 2026
@ngbot

ngbot Bot commented Jun 17, 2026

Copy link
Copy Markdown

I see that you just added the action: merge label, but the following checks are still failing:
    failure conflicts with base branch "main"
If you want your PR to be merged, it has to pass all the CI checks.
If you can't get the PR to a green state due to flakes or broken main, please try rebasing to main and/or restarting the CI job. If that fails and you believe that the issue is not due to your change, please contact the caretaker and ask for help.

clydin added 3 commits June 17, 2026 07:25
…er abstraction

Transition the update command's version resolver to utilize the registry methods from the
PackageManager abstraction instead of directly querying the registry via pacote.

This introduces a cached RegistryClient wrapper that retrieves package metadata and manifests
on-demand. Update resolution helper functions are updated to be asynchronous to support the
lazy-loading of registry documents.
…y authentication

Configure always-auth in the written .npmrc and .yarnrc test profiles within
createNpmConfigForAuthentication.

By default, Yarn Classic (v1) does not send the Authorization header on GET requests (such as
retrieving manifest metadata via yarn info) unless always-auth is enabled. When ng update uses the
PackageManager abstraction under Yarn Classic v1, this ensures the necessary authorization headers
are sent to secure registry endpoints.
When running scripts via Yarn Classic (such as yarn ng update), Yarn automatically injects
npm_config_registry=https://registry.yarnpkg.com into the child process environment.

When the PackageManager abstraction spawns child CLI subprocesses (such as yarn info), those child
processes inherit the injected registry environment variable. Because environment variables take
highest precedence, this previously caused spawned subprocesses to ignore local .yarnrc files and
query the public CDN mirror.

Strip npm_config_registry and NPM_CONFIG_REGISTRY from the child process environment when running
under Yarn so that spawned subprocesses correctly respect local repository registry settings.
@clydin clydin force-pushed the refactor-update-package-manager-abstraction branch from 50c1489 to c5d973d Compare June 17, 2026 11:26
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: minor This PR is targeted for the next minor release

Projects

None yet

2 participants