Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Query dependencies of a child workspace returns no results #6828

Closed
2 tasks done
Carl-Foster opened this issue Sep 22, 2023 · 1 comment · Fixed by #6829
Closed
2 tasks done

[BUG] Query dependencies of a child workspace returns no results #6828

Carl-Foster opened this issue Sep 22, 2023 · 1 comment · Fixed by #6829
Labels
Bug thing that needs fixing Needs Triage needs review for next steps Release 9.x work is associated with a specific npm 9 release

Comments

@Carl-Foster
Copy link
Contributor

Is there an existing issue for this?

  • I have searched the existing issues

This issue exists in the latest npm version

  • I am using the latest npm

Current Behavior

Dependencies of a child workspace are not returned during npm query.

Given a dependency chain applications/my-app -> packages/top-level-library -> packages/lower-level-library,
When I query with selector .workspace > .workspace > *
Then no dependencies are returned.

Expected Behavior

Dependencies of child workspaces should be returned with npm query.

Given a dependency chain applications/my-app -> packages/top-level-library -> packages/lower-level-library,
When I query with selector .workspace > .workspace > *
Then lower-level-library is returned.

Steps To Reproduce

  1. Setup:
$ mkdir test-workspaces && cd test-workspaces
$ npm init -y
$ npm init -y -w applications/my-app
$ npm init -y -w packages/top-level-library
$ npm init -y -w packages/lower-level-library
$ npm install -w packages/top-level-library ./packages/lower-level-library
$ npm install -w applications/my-app ./packages/top-level-library
  1. Query:
$ npm query ".workspace" | jq 'map(.name)|join(",")'
my-app,top-level-library,lower-level-library
$ npm query ".workspace > .workspace" | jq 'map(.name)|join(",")'
top-level-library,lower-level-library
$ npm query ".workspace > .workspace > .workspace" | jq 'map(.name)|join(",")'

Environment

  • npm: 9.8.1, 10.1.0
  • Node.js: 18.18.0
  • OS Name: MacOS
  • System Model Name: Macbook Pro
  • npm config:
; copy and paste output from `npm config ls` here
@Carl-Foster Carl-Foster added Bug thing that needs fixing Needs Triage needs review for next steps Release 9.x work is associated with a specific npm 9 release labels Sep 22, 2023
@Carl-Foster Carl-Foster changed the title [BUG] Query child dependencies of a child workspace returns no results [BUG] Query dependencies of a child workspace returns no results Sep 22, 2023
@Carl-Foster
Copy link
Contributor Author

This is a particular annoyance as I want to find all child workspaces for a specific application workspace however it only ever returns the direct children. This is in contrast to the behaviour of non-workspace dependencies.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug thing that needs fixing Needs Triage needs review for next steps Release 9.x work is associated with a specific npm 9 release
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant