Skip to content

fix(@angular/cli): recursively collect nested workspace dependencies in npm - #33038

Closed
clydin wants to merge 1 commit into
angular:mainfrom
clydin:fix-npm-workspaces-update
Closed

fix(@angular/cli): recursively collect nested workspace dependencies in npm#33038
clydin wants to merge 1 commit into
angular:mainfrom
clydin:fix-npm-workspaces-update

Conversation

@clydin

@clydin clydin commented Apr 23, 2026

Copy link
Copy Markdown
Member

When running the update command in an npm workspace repository from within a workspace subdirectory, the CLI currently fails to detect hoisted dependencies. This occurs because npm list structures its workspace dependency output as nested items inside their respective top-level workspace entry, rather than as top-level items. The current parser was only reading the top-level items and consequently missed nested workspace dependencies.

This change updates the dependency parser to perform a breadth-first traversal of the JSON tree output of the package list command. By iteratively traversing the nested dependencies, the CLI can successfully resolve all installed packages within an npm workspaces monorepo.

@clydin
clydin marked this pull request as ready for review April 23, 2026 15:39

@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 parseNpmLikeDependencies function to support nested dependencies through a breadth-first traversal and adds unit tests for workspace scenarios. Feedback was provided to optimize performance by avoiding O(N^2) operations with shift() and to ensure that shallower dependency versions are preserved rather than overwritten by nested ones.

Comment thread packages/angular/cli/src/package-managers/parsers.ts
…in npm

When running the update command in an npm workspace repository from within a workspace subdirectory, the CLI currently fails to detect hoisted dependencies. This occurs because npm list structures its workspace dependency output as nested items inside their respective top-level workspace entry, rather than as top-level items. The current parser was only reading the top-level items and consequently missed nested workspace dependencies.

This change updates the dependency parser to perform a breadth-first traversal of the JSON tree output of the package list command. By iteratively traversing the nested dependencies, the CLI can successfully resolve all installed packages within an npm workspaces monorepo.
@clydin
clydin force-pushed the fix-npm-workspaces-update branch from 1401ec7 to 8532c3b Compare April 23, 2026 16:06
@clydin clydin closed this Apr 23, 2026
@angular-automatic-lock-bot

Copy link
Copy Markdown

This pull request has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot Bot locked and limited conversation to collaborators May 24, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant