Skip to content

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

Open
clydin wants to merge 1 commit into
angular:mainfrom
clydin:fix-pnpm-workspaces-update
Open

fix(@angular/cli): support resolving subproject dependencies in pnpm workspaces#33546
clydin wants to merge 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
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: patch This PR is targeted for the next patch release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant