Skip to content

Commit b6d8b54

Browse files
committed
Fix pnpm compatibility
`@npmcli/arborist` (incorrectly?) returns dependencies with no package info when looking in `/node_modules/.pnpm` directory. It does also return correct data from deeper nested dirs like for example `/node_modules/.pnpm/[email protected]/node_modules/tmp` so we can just ignore the invalid entries.
1 parent d44aa11 commit b6d8b54

File tree

10 files changed

+80
-1
lines changed

10 files changed

+80
-1
lines changed

index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ function licensee (configuration, path, callback) {
3838
.then(function (tree) {
3939
var dependencies = Array.from(tree.inventory.values())
4040
.filter(function (dependency) {
41-
return !dependency.isProjectRoot
41+
return !dependency.isProjectRoot && dependency.package.name
4242
})
4343
if (configuration.filterPackages) {
4444
dependencies = configuration.filterPackages(dependencies)
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"licenses": {
3+
"spdx": [
4+
"Apache-2.0"
5+
]
6+
},
7+
"packages": {
8+
"mit-licensed": "1.0.0"
9+
}
10+
}

tests/pnpm-compatibility/node_modules/.modules.yaml

Lines changed: 21 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests/pnpm-compatibility/node_modules/.pnpm/lock.yaml

Lines changed: 13 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests/pnpm-compatibility/node_modules/.pnpm/[email protected]/node_modules/mit-licensed/index.js

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests/pnpm-compatibility/node_modules/.pnpm/[email protected]/node_modules/mit-licensed/package.json

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests/pnpm-compatibility/node_modules/mit-licensed

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"name": "pnpm-workspace",
3+
"dependencies": {
4+
"mit-licensed": "^1.0.0"
5+
},
6+
"private": true
7+
}

tests/pnpm-compatibility/pnpm-lock.yaml

Lines changed: 13 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests/pnpm-compatibility/test.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
var tap = require('tap')
2+
3+
var results = require('../run')([], __dirname)
4+
5+
tap.equal(results.status, 0)

0 commit comments

Comments
 (0)