Skip to content

Commit d3a4161

Browse files
authored
deps: @npmcli/[email protected] (#9000)
1 parent 0a5756d commit d3a4161

File tree

6 files changed

+40
-13
lines changed

6 files changed

+40
-13
lines changed

DEPENDENCIES.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -635,7 +635,7 @@ graph LR;
635635
npmcli-package-json-->npmcli-git["@npmcli/git"];
636636
npmcli-package-json-->proc-log;
637637
npmcli-package-json-->semver;
638-
npmcli-package-json-->validate-npm-package-license;
638+
npmcli-package-json-->spdx-expression-parse;
639639
npmcli-promise-spawn-->which;
640640
npmcli-query-->postcss-selector-parser;
641641
npmcli-run-script-->node-gyp;
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
// This is an implementation of the validForNewPackage flag in validate-npm-package-license, which is no longer maintained
2+
3+
const parse = require('spdx-expression-parse')
4+
5+
function usesLicenseRef (ast) {
6+
if (Object.hasOwn(ast, 'license')) {
7+
return ast.license.startsWith('LicenseRef') || ast.license.startsWith('DocumentRef')
8+
} else {
9+
return usesLicenseRef(ast.left) || usesLicenseRef(ast.right)
10+
}
11+
}
12+
13+
// license should be a valid SPDX license expression (without "LicenseRef"), "UNLICENSED", or "SEE LICENSE IN <filename>"
14+
module.exports = function licenseValidForNewPackage (argument) {
15+
if (argument === 'UNLICENSED' || argument === 'UNLICENCED') {
16+
return true
17+
}
18+
if (/^SEE LICEN[CS]E IN ./.test(argument)) {
19+
return true
20+
}
21+
try {
22+
const ast = parse(argument)
23+
return !usesLicenseRef(ast)
24+
} catch {
25+
return false
26+
}
27+
}

node_modules/@npmcli/package-json/lib/normalize-data.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
const { URL } = require('node:url')
44
const hostedGitInfo = require('hosted-git-info')
5-
const validateLicense = require('validate-npm-package-license')
5+
const validateLicense = require('./license.js')
66

77
const typos = {
88
dependancies: 'dependencies',
@@ -230,7 +230,7 @@ function normalizeData (data, changes) {
230230
changes?.push('No license field.')
231231
} else if (typeof (license) !== 'string' || license.length < 1 || license.trim() === '') {
232232
changes?.push('license should be a valid SPDX license expression')
233-
} else if (!validateLicense(license).validForNewPackages) {
233+
} else if (!validateLicense(license)) {
234234
changes?.push('license should be a valid SPDX license expression')
235235
}
236236
// fixPeople

node_modules/@npmcli/package-json/package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@npmcli/package-json",
3-
"version": "7.0.4",
3+
"version": "7.0.5",
44
"description": "Programmatic API to update package.json",
55
"keywords": [
66
"npm",
@@ -35,19 +35,19 @@
3535
"json-parse-even-better-errors": "^5.0.0",
3636
"proc-log": "^6.0.0",
3737
"semver": "^7.5.3",
38-
"validate-npm-package-license": "^3.0.4"
38+
"spdx-expression-parse": "^4.0.0"
3939
},
4040
"devDependencies": {
4141
"@npmcli/eslint-config": "^6.0.0",
42-
"@npmcli/template-oss": "4.28.0",
42+
"@npmcli/template-oss": "4.28.1",
4343
"tap": "^16.0.1"
4444
},
4545
"engines": {
4646
"node": "^20.17.0 || >=22.9.0"
4747
},
4848
"templateOSS": {
4949
"//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.",
50-
"version": "4.28.0",
50+
"version": "4.28.1",
5151
"publish": "true"
5252
},
5353
"tap": {

package-lock.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@
8989
"@npmcli/fs": "^5.0.0",
9090
"@npmcli/map-workspaces": "^5.0.3",
9191
"@npmcli/metavuln-calculator": "^9.0.3",
92-
"@npmcli/package-json": "^7.0.4",
92+
"@npmcli/package-json": "^7.0.5",
9393
"@npmcli/promise-spawn": "^9.0.1",
9494
"@npmcli/redact": "^4.0.0",
9595
"@npmcli/run-script": "^10.0.3",
@@ -1838,9 +1838,9 @@
18381838
}
18391839
},
18401840
"node_modules/@npmcli/package-json": {
1841-
"version": "7.0.4",
1842-
"resolved": "https://registry.npmjs.org/@npmcli/package-json/-/package-json-7.0.4.tgz",
1843-
"integrity": "sha512-0wInJG3j/K40OJt/33ax47WfWMzZTm6OQxB9cDhTt5huCP2a9g2GnlsxmfN+PulItNPIpPrZ+kfwwUil7eHcZQ==",
1841+
"version": "7.0.5",
1842+
"resolved": "https://registry.npmjs.org/@npmcli/package-json/-/package-json-7.0.5.tgz",
1843+
"integrity": "sha512-iVuTlG3ORq2iaVa1IWUxAO/jIp77tUKBhoMjuzYW2kL4MLN1bi/ofqkZ7D7OOwh8coAx1/S2ge0rMdGv8sLSOQ==",
18441844
"inBundle": true,
18451845
"license": "ISC",
18461846
"dependencies": {
@@ -1850,7 +1850,7 @@
18501850
"json-parse-even-better-errors": "^5.0.0",
18511851
"proc-log": "^6.0.0",
18521852
"semver": "^7.5.3",
1853-
"validate-npm-package-license": "^3.0.4"
1853+
"spdx-expression-parse": "^4.0.0"
18541854
},
18551855
"engines": {
18561856
"node": "^20.17.0 || >=22.9.0"

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@
5757
"@npmcli/fs": "^5.0.0",
5858
"@npmcli/map-workspaces": "^5.0.3",
5959
"@npmcli/metavuln-calculator": "^9.0.3",
60-
"@npmcli/package-json": "^7.0.4",
60+
"@npmcli/package-json": "^7.0.5",
6161
"@npmcli/promise-spawn": "^9.0.1",
6262
"@npmcli/redact": "^4.0.0",
6363
"@npmcli/run-script": "^10.0.3",

0 commit comments

Comments
 (0)