Skip to content

perf(@angular/cli): lazily resolve package manager version to optimize startup - #33902

Closed
alan-agius4 wants to merge 1 commit into
angular:mainfrom
alan-agius4:perf-lazy-package-manager-version
Closed

perf(@angular/cli): lazily resolve package manager version to optimize startup#33902
alan-agius4 wants to merge 1 commit into
angular:mainfrom
alan-agius4:perf-lazy-package-manager-version

Conversation

@alan-agius4

Copy link
Copy Markdown
Collaborator

PR Checklist

Please check to confirm your PR fulfills the following requirements:

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Performance improvement
  • Documentation content changes
  • Other... Please describe:

What is the current behavior?

determinePackageManager and createPackageManager eagerly call getPackageManagerVersion during command execution startup, spawning child processes (npm --version, pnpm --version, yarn --version, bun --version) on cold starts even when the command does not perform any package manager operations.

What is the new behavior?

  • determinePackageManager and createPackageManager no longer spawn child processes to query versions during initial command creation.
  • Package manager version resolution is deferred until explicitly required by package management operations or version queries.
  • Added a synchronous version getter on PackageManager to allow non-blocking version inspection where available.
  • Updated getAnalytics() in command-module.ts to avoid awaiting getVersion().

Does this PR introduce a breaking change?

  • Yes
  • No

…e startup

Eagerly determining package manager version on every CLI command execution causes a child process spawn (npm/pnpm/yarn/bun --version) on cold start.

This change defers version resolution until explicitly needed (e.g. during package operations or version display).
@angular-robot angular-robot Bot added area: performance Issues related to performance area: @angular/cli labels Aug 24, 2026
@alan-agius4
alan-agius4 deleted the perf-lazy-package-manager-version branch August 24, 2026 09:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: @angular/cli area: performance Issues related to performance

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant