diff --git a/index.js b/index.js index c0e4822..87453c1 100644 --- a/index.js +++ b/index.js @@ -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) diff --git a/tests/pnpm-compatibility/.licensee.json b/tests/pnpm-compatibility/.licensee.json new file mode 100644 index 0000000..9f655f7 --- /dev/null +++ b/tests/pnpm-compatibility/.licensee.json @@ -0,0 +1,10 @@ +{ + "licenses": { + "spdx": [ + "Apache-2.0" + ] + }, + "packages": { + "mit-licensed": "1.0.0" + } +} diff --git a/tests/pnpm-compatibility/node_modules/.modules.yaml b/tests/pnpm-compatibility/node_modules/.modules.yaml new file mode 100644 index 0000000..4fc5043 --- /dev/null +++ b/tests/pnpm-compatibility/node_modules/.modules.yaml @@ -0,0 +1,21 @@ +hoistPattern: + - '*' +hoistedDependencies: {} +included: + dependencies: true + devDependencies: true + optionalDependencies: true +injectedDeps: {} +layoutVersion: 5 +nodeLinker: isolated +packageManager: pnpm@7.14.2 +pendingBuilds: [] +prunedAt: Fri, 04 Nov 2022 21:34:40 GMT +publicHoistPattern: + - '*eslint*' + - '*prettier*' +registries: + default: https://registry.npmjs.org/ +skipped: [] +storeDir: /Users/cvx/Library/pnpm/store/v3 +virtualStoreDir: .pnpm diff --git a/tests/pnpm-compatibility/node_modules/.pnpm/lock.yaml b/tests/pnpm-compatibility/node_modules/.pnpm/lock.yaml new file mode 100644 index 0000000..36b5dc2 --- /dev/null +++ b/tests/pnpm-compatibility/node_modules/.pnpm/lock.yaml @@ -0,0 +1,13 @@ +lockfileVersion: 5.4 + +specifiers: + mit-licensed: ^1.0.0 + +dependencies: + mit-licensed: 1.0.0 + +packages: + + /mit-licensed/1.0.0: + resolution: {integrity: sha512-aCppNedGHnTQZvrrNcX43bMZSvLHlH2ZwC7NJqr05onseQjx0+GDGz3a44ONAVpefHPW8GQN8kNW02e+MG088A==} + dev: false diff --git a/tests/pnpm-compatibility/node_modules/.pnpm/mit-licensed@1.0.0/node_modules/mit-licensed/index.js b/tests/pnpm-compatibility/node_modules/.pnpm/mit-licensed@1.0.0/node_modules/mit-licensed/index.js new file mode 100644 index 0000000..d0e9332 --- /dev/null +++ b/tests/pnpm-compatibility/node_modules/.pnpm/mit-licensed@1.0.0/node_modules/mit-licensed/index.js @@ -0,0 +1 @@ +throw new Error('Do not require mit-licensed. It is just for testing license metadata.') diff --git a/tests/pnpm-compatibility/node_modules/.pnpm/mit-licensed@1.0.0/node_modules/mit-licensed/package.json b/tests/pnpm-compatibility/node_modules/.pnpm/mit-licensed@1.0.0/node_modules/mit-licensed/package.json new file mode 100644 index 0000000..dbb0145 --- /dev/null +++ b/tests/pnpm-compatibility/node_modules/.pnpm/mit-licensed@1.0.0/node_modules/mit-licensed/package.json @@ -0,0 +1,8 @@ +{ + "name": "mit-licensed", + "version": "1.0.0", + "description": "an empty package that is MIT-licensed", + "author": "Kyle E. Mitchell (https://kemitchell.com/)", + "repository": "jslicense/mit-licensed.js", + "license": "MIT" +} diff --git a/tests/pnpm-compatibility/node_modules/mit-licensed b/tests/pnpm-compatibility/node_modules/mit-licensed new file mode 120000 index 0000000..85cf516 --- /dev/null +++ b/tests/pnpm-compatibility/node_modules/mit-licensed @@ -0,0 +1 @@ +.pnpm/mit-licensed@1.0.0/node_modules/mit-licensed \ No newline at end of file diff --git a/tests/pnpm-compatibility/package.json b/tests/pnpm-compatibility/package.json new file mode 100644 index 0000000..9c7e98a --- /dev/null +++ b/tests/pnpm-compatibility/package.json @@ -0,0 +1,7 @@ +{ + "name": "pnpm-workspace", + "dependencies": { + "mit-licensed": "^1.0.0" + }, + "private": true +} diff --git a/tests/pnpm-compatibility/pnpm-lock.yaml b/tests/pnpm-compatibility/pnpm-lock.yaml new file mode 100644 index 0000000..36b5dc2 --- /dev/null +++ b/tests/pnpm-compatibility/pnpm-lock.yaml @@ -0,0 +1,13 @@ +lockfileVersion: 5.4 + +specifiers: + mit-licensed: ^1.0.0 + +dependencies: + mit-licensed: 1.0.0 + +packages: + + /mit-licensed/1.0.0: + resolution: {integrity: sha512-aCppNedGHnTQZvrrNcX43bMZSvLHlH2ZwC7NJqr05onseQjx0+GDGz3a44ONAVpefHPW8GQN8kNW02e+MG088A==} + dev: false diff --git a/tests/pnpm-compatibility/test.js b/tests/pnpm-compatibility/test.js new file mode 100644 index 0000000..add2337 --- /dev/null +++ b/tests/pnpm-compatibility/test.js @@ -0,0 +1,5 @@ +var tap = require('tap') + +var results = require('../run')([], __dirname) + +tap.equal(results.status, 0)