-
Notifications
You must be signed in to change notification settings - Fork 75
Closed
npm/cli
#6782Description
Is there an existing issue for this?
- I have searched the existing issues
Current Behavior
Assuming the following project set-up:
$ cat package.json
{
"name": "root",
"version": "1.0.0",
"workspaces": ["./a", "./b"]
}
$ npm ls -all
root@1.0.0 /private/tmp/root
├─┬ a@1.0.0 -> ./a
│ └── b@1.0.0 deduped -> ./b
└─┬ b@1.0.0 -> ./b
└── lodash@4.17.21
Run the query:
$ npm query '#a *' | jq '.[].name'
The only returned result is:
"b"
Expected Behavior
Run the query:
$ npm query '#a *' | jq '.[].name'
The returned result should be:
"b"
"lodash"
Similar to the result returned from npm-ls with the --workspace flag:
$ npm ls --workspace a
root@1.0.0 /private/tmp/root
└─┬ a@1.0.0 -> ./a
└─┬ b@1.0.0 -> ./b
└── lodash@4.17.21
Steps To Reproduce
Set-up the following directory structure:
root
├── a
│ └── package.json
├── b
│ └── package.json
└── package.json
In the root directory, create the following package.json file:
{
"name": "root",
"version": "1.0.0",
"workspaces": ["./a", "./b"]
}In the a directory, create the following package.json file:
{
"name": "a",
"version": "1.0.0",
"dependencies": {
"b": "1.0.0"
}
}In the b directory, create the following package.json file:
{
"name": "b",
"version": "1.0.0",
"dependencies": {
"lodash": "^4.17.21"
}
}Execute the following:
$ npm query '#a *' | jq '.[].name'
"b"
Note that b is returned but NOT lodash
Environment
- npm: 10.0.0
- Node: v18.12.1
- OS: macOS
- platform: arm64
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels