Skip to content

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

Description

@Carl-Foster

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Bugthing that needs fixingNeeds Triageneeds review for next stepsRelease 9.xwork is associated with a specific npm 9 release

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions