Skip to content

fix(@angular/cli): support resolving subproject dependencies in pnpm workspaces#33546

Merged
clydin merged 1 commit into
angular:mainfrom
clydin:fix-pnpm-workspaces-update
Jul 13, 2026
Merged

fix(@angular/cli): support resolving subproject dependencies in pnpm workspaces#33546
clydin merged 1 commit into
angular:mainfrom
clydin:fix-pnpm-workspaces-update

Conversation

@clydin

@clydin clydin commented Jul 10, 2026

Copy link
Copy Markdown
Member

When running dependency listing commands (like pnpm list --depth=0 --json) in a workspace subproject, the package manager resolves the workspace layout and runs in the context of the workspace root, returning an array of project objects representing all workspace members.

Previously, parseNpmLikeDependencies blindly selected the first item in the array (data[0]), which corresponds to the workspace root package. Since the root package typically does not declare workspace member dependencies (like @angular/core), ng update failed with "Package X is not a dependency" errors.

This updates parseNpmLikeDependencies to search the array for the project matching workspacePackageName if it is provided. If the selected project is the workspace member itself, it bypasses the nested workspace dependency lookup block, allowing its direct dependencies to be parsed correctly.

@clydin clydin added the target: patch This PR is targeted for the next patch release label Jul 10, 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 updates the dependency parser to correctly handle arrays of projects (such as those returned by pnpm) by searching for a project that matches the specified workspacePackageName. It also adds corresponding unit tests to verify this behavior. Feedback was provided to add defensive checks for data being null, undefined, or a non-object to prevent potential runtime TypeError crashes when accessing its properties.

Comment thread packages/angular/cli/src/package-managers/parsers.ts Outdated
@clydin clydin force-pushed the fix-pnpm-workspaces-update branch from 29a2458 to 8b3ae0a Compare July 10, 2026 15:47
@clydin clydin added the action: review The PR is still awaiting reviews from at least one requested reviewer label Jul 10, 2026
@clydin clydin requested a review from alan-agius4 July 10, 2026 15:48
@clydin clydin force-pushed the fix-pnpm-workspaces-update branch from 8b3ae0a to f5195bf Compare July 10, 2026 15:54
…workspaces

When running dependency listing commands (like `pnpm list --depth=0 --json`) in a workspace subproject, the package manager resolves the workspace layout and runs in the context of the workspace root, returning an array of project objects representing all workspace members.

Previously, `parseNpmLikeDependencies` blindly selected the first item in the array (`data[0]`), which corresponds to the workspace root package. Since the root package typically does not declare workspace member dependencies (like `@angular/core`), `ng update` failed with "Package X is not a dependency" errors.

This updates `parseNpmLikeDependencies` to search the array for the project matching `workspacePackageName` if it is provided. If the selected project is the workspace member itself, it bypasses the nested workspace dependency lookup block, allowing its direct dependencies to be parsed correctly.
@clydin clydin force-pushed the fix-pnpm-workspaces-update branch from f5195bf to 6361aa6 Compare July 10, 2026 17:10
@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 Jul 13, 2026
@clydin clydin merged commit b0b3a47 into angular:main Jul 13, 2026
40 checks passed
@clydin

clydin commented Jul 13, 2026

Copy link
Copy Markdown
Member Author

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

@clydin clydin deleted the fix-pnpm-workspaces-update branch July 13, 2026 13:16
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.

2 participants