Skip to content

Conversation

@clydin
Copy link
Member

@clydin clydin commented Jan 15, 2026

This commit introduces a "hot cache" mechanism for the package manager version. When the package manager factory determines the version (e.g., to distinguish between Yarn and Yarn Classic), it now passes that discovered version to the PackageManager instance.

The PackageManager class has been updated to:

  1. Accept an optional version in its constructor options.
  2. Cache the version internally after the first fetch.
  3. Use the cached/injected version in getVersion() to avoid redundant shell commands.

This commit introduces a "hot cache" mechanism for the package manager version.
When the package manager factory determines the version (e.g., to distinguish between Yarn and Yarn Classic), it now passes that discovered version to the `PackageManager` instance.

The `PackageManager` class has been updated to:
1. Accept an optional `version` in its constructor options.
2. Cache the version internally after the first fetch.
3. Use the cached/injected version in `getVersion()` to avoid redundant shell commands.

This improves startup performance by eliminating unnecessary child process spawning when the version is already known.

Additionally, an assertion has been added to ensure that the version command for `yarn` and `yarn-classic` remains consistent, as the detection logic relies on this.
@clydin clydin added the target: minor This PR is targeted for the next minor release label Jan 15, 2026
@clydin clydin added the action: review The PR is still awaiting reviews from at least one requested reviewer label Jan 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

action: review The PR is still awaiting reviews from at least one requested reviewer area: @angular/cli target: minor This PR is targeted for the next minor release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant