fix(@angular/cli): support resolving subproject dependencies in pnpm workspaces#33546
Open
clydin wants to merge 1 commit into
Open
fix(@angular/cli): support resolving subproject dependencies in pnpm workspaces#33546clydin wants to merge 1 commit into
clydin wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
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.
29a2458 to
8b3ae0a
Compare
8b3ae0a to
f5195bf
Compare
…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.
f5195bf to
6361aa6
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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,
parseNpmLikeDependenciesblindly 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 updatefailed with "Package X is not a dependency" errors.This updates
parseNpmLikeDependenciesto search the array for the project matchingworkspacePackageNameif 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.