Skip to content

fix(@angular/cli): resolve package name in npm workspace members - #34308

Merged
alan-agius4 merged 2 commits into
angular:mainfrom
alan-agius4:fix/npm-workspace-package-name
Oct 13, 2026
Merged

alan-agius4 merged 2 commits into
angular:mainfrom
alan-agius4:fix/npm-workspace-package-name

Conversation

@alan-agius4

Copy link
Copy Markdown
Collaborator

Read package.json in the working directory first in getCurrentPackageName to avoid spawning an unnecessary child process, and handle single-entry workspace objects returned by npm pkg get name when falling back to the package manager command.

Closes #32787

@alan-agius4
alan-agius4 requested a review from clydin October 12, 2026 07:52
@alan-agius4 alan-agius4 added action: review The PR is still awaiting reviews from at least one requested reviewer target: patch This PR is targeted for the next patch release and removed area: @angular/cli labels Oct 12, 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 optimizes getCurrentPackageName by reading package.json directly before falling back to the package manager command, and adds support for handling workspace objects returned by package managers. Unit tests were added to verify these changes. Feedback suggests simplifying a test mock in package-manager_spec.ts to remove dead code, as the package manager command is no longer invoked during that test.

Comment thread packages/angular/cli/src/package-managers/package-manager_spec.ts Outdated
Read `package.json` in the working directory first in `getCurrentPackageName` to avoid spawning an unnecessary child process, and handle single-entry workspace objects returned by `npm pkg get name` when falling back to the package manager command.

Closes angular#32787
@alan-agius4
alan-agius4 force-pushed the fix/npm-workspace-package-name branch from 2ee0a44 to 088f196 Compare October 12, 2026 11:26
@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 Oct 13, 2026
@alan-agius4
alan-agius4 merged commit a1cf33b into angular:main Oct 13, 2026
40 checks passed
@alan-agius4
alan-agius4 deleted the fix/npm-workspace-package-name branch October 13, 2026 06:00
@alan-agius4

Copy link
Copy Markdown
Collaborator Author

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

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: patch This PR is targeted for the next patch release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

v21.2.2 seems to be unable to handle npm workspaces

2 participants