Skip to content

Commit

Permalink
Fix pnpm compatibility
Browse files Browse the repository at this point in the history
`@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.
  • Loading branch information
CvX committed Apr 7, 2023
1 parent d44aa11 commit b6d8b54
Show file tree
Hide file tree
Showing 10 changed files with 80 additions and 1 deletion.
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ function licensee (configuration, path, callback) {
.then(function (tree) {
var dependencies = Array.from(tree.inventory.values())
.filter(function (dependency) {
return !dependency.isProjectRoot
return !dependency.isProjectRoot && dependency.package.name
})
if (configuration.filterPackages) {
dependencies = configuration.filterPackages(dependencies)
Expand Down
10 changes: 10 additions & 0 deletions tests/pnpm-compatibility/.licensee.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"licenses": {
"spdx": [
"Apache-2.0"
]
},
"packages": {
"mit-licensed": "1.0.0"
}
}
21 changes: 21 additions & 0 deletions tests/pnpm-compatibility/node_modules/.modules.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 13 additions & 0 deletions tests/pnpm-compatibility/node_modules/.pnpm/lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions tests/pnpm-compatibility/node_modules/mit-licensed

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions tests/pnpm-compatibility/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"name": "pnpm-workspace",
"dependencies": {
"mit-licensed": "^1.0.0"
},
"private": true
}
13 changes: 13 additions & 0 deletions tests/pnpm-compatibility/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions tests/pnpm-compatibility/test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
var tap = require('tap')

var results = require('../run')([], __dirname)

tap.equal(results.status, 0)

0 comments on commit b6d8b54

Please sign in to comment.