Skip to content

Commit 4a9a705

Browse files
committed
deps: @npmcli/[email protected]
1 parent e034a8e commit 4a9a705

File tree

8 files changed

+70
-24
lines changed

8 files changed

+70
-24
lines changed

node_modules/@npmcli/package-json/lib/index.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,13 +73,15 @@ class PackageJson {
7373
)
7474
}
7575

76-
for (const step of knownSteps)
76+
for (const step of knownSteps) {
7777
this[_manifest] = step({ content, originalContent: this[_manifest] })
78+
}
7879

7980
// unknown properties will just be overwitten
8081
for (const [key, value] of Object.entries(content)) {
81-
if (!knownKeys.has(key))
82+
if (!knownKeys.has(key)) {
8283
this[_manifest][key] = value
84+
}
8385
}
8486

8587
return this
@@ -98,8 +100,9 @@ class PackageJson {
98100
}\n`
99101
.replace(/\n/g, eol)
100102

101-
if (fileContent.trim() !== this[_readFileContent].trim())
103+
if (fileContent.trim() !== this[_readFileContent].trim()) {
102104
return await writeFile(this[_filename], fileContent)
105+
}
103106
}
104107
}
105108

node_modules/@npmcli/package-json/lib/update-dependencies.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,25 +28,28 @@ const updateDependencies = ({ content, originalContent }) => {
2828
// optionalDependencies don't need to be repeated in two places
2929
if (pkg.dependencies) {
3030
if (pkg.optionalDependencies) {
31-
for (const name of Object.keys(pkg.optionalDependencies))
31+
for (const name of Object.keys(pkg.optionalDependencies)) {
3232
delete pkg.dependencies[name]
33+
}
3334
}
3435
}
3536

3637
const result = { ...originalContent }
3738

3839
// loop through all types of dependencies and update package json pkg
3940
for (const type of depTypes) {
40-
if (pkg[type])
41+
if (pkg[type]) {
4142
result[type] = pkg[type]
43+
}
4244

4345
// prune empty type props from resulting object
4446
const emptyDepType =
4547
pkg[type]
4648
&& typeof pkg === 'object'
4749
&& Object.keys(pkg[type]).length === 0
48-
if (emptyDepType)
50+
if (emptyDepType) {
4951
delete result[type]
52+
}
5053
}
5154

5255
// if original package.json had dep in peerDeps AND deps, preserve that.

node_modules/@npmcli/package-json/lib/update-scripts.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
const updateScripts = ({ content, originalContent = {} }) => {
22
const newScripts = content.scripts
33

4-
if (!newScripts)
4+
if (!newScripts) {
55
return originalContent
6+
}
67

78
// validate scripts content being appended
89
const hasInvalidScripts = () =>

node_modules/@npmcli/package-json/lib/update-workspaces.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
const updateWorkspaces = ({ content, originalContent = {} }) => {
22
const newWorkspaces = content.workspaces
33

4-
if (!newWorkspaces)
4+
if (!newWorkspaces) {
55
return originalContent
6+
}
67

78
// validate workspaces content being appended
89
const hasInvalidWorkspaces = () =>
Lines changed: 22 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,24 @@
11
{
22
"name": "@npmcli/package-json",
3-
"version": "1.0.1",
3+
"version": "2.0.0",
44
"description": "Programmatic API to update package.json",
55
"main": "lib/index.js",
66
"files": [
7-
"lib"
7+
"bin/",
8+
"lib/"
89
],
910
"scripts": {
1011
"preversion": "npm test",
1112
"postversion": "npm publish",
1213
"prepublishOnly": "git push origin --follow-tags",
1314
"snap": "tap",
1415
"test": "tap",
15-
"npmclilint": "npmcli-lint",
16-
"lint": "npm run npmclilint -- \"lib/*.*js\" \"test/*.*js\"",
16+
"lint": "eslint \"**/*.js\"",
1717
"lintfix": "npm run lint -- --fix",
18-
"posttest": "npm run lint --",
19-
"postsnap": "npm run lintfix --"
18+
"posttest": "npm run lint",
19+
"postsnap": "npm run lintfix --",
20+
"postlint": "template-oss-check",
21+
"template-oss-apply": "template-oss-apply --force"
2022
},
2123
"keywords": [
2224
"npm",
@@ -25,10 +27,22 @@
2527
"author": "GitHub Inc.",
2628
"license": "ISC",
2729
"devDependencies": {
28-
"@npmcli/lint": "^1.0.1",
29-
"tap": "^15.0.9"
30+
"@npmcli/eslint-config": "^3.0.1",
31+
"@npmcli/template-oss": "3.2.2",
32+
"tap": "^16.0.1"
3033
},
3134
"dependencies": {
3235
"json-parse-even-better-errors": "^2.3.1"
36+
},
37+
"repository": {
38+
"type": "git",
39+
"url": "https://github.com/npm/package-json.git"
40+
},
41+
"engines": {
42+
"node": "^12.13.0 || ^14.15.0 || >=16.0.0"
43+
},
44+
"templateOSS": {
45+
"//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.",
46+
"version": "3.2.2"
3347
}
3448
}

package-lock.json

Lines changed: 30 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@
9393
"@npmcli/config": "^4.0.1",
9494
"@npmcli/fs": "^2.1.0",
9595
"@npmcli/map-workspaces": "^2.0.2",
96-
"@npmcli/package-json": "^1.0.1",
96+
"@npmcli/package-json": "^2.0.0",
9797
"@npmcli/run-script": "^3.0.1",
9898
"abbrev": "~1.1.1",
9999
"ansicolors": "~0.3.2",
@@ -973,11 +973,15 @@
973973
"license": "ISC"
974974
},
975975
"node_modules/@npmcli/package-json": {
976-
"version": "1.0.1",
976+
"version": "2.0.0",
977+
"resolved": "https://registry.npmjs.org/@npmcli/package-json/-/package-json-2.0.0.tgz",
978+
"integrity": "sha512-42jnZ6yl16GzjWSH7vtrmWyJDGVa/LXPdpN2rcUWolFjc9ON2N3uz0qdBbQACfmhuJZ2lbKYtmK5qx68ZPLHMA==",
977979
"inBundle": true,
978-
"license": "ISC",
979980
"dependencies": {
980981
"json-parse-even-better-errors": "^2.3.1"
982+
},
983+
"engines": {
984+
"node": "^12.13.0 || ^14.15.0 || >=16.0.0"
981985
}
982986
},
983987
"node_modules/@npmcli/promise-spawn": {
@@ -1033,6 +1037,15 @@
10331037
"node": "^12.13.0 || ^14.15.0 || >=16.0.0"
10341038
}
10351039
},
1040+
"node_modules/@npmcli/template-oss/node_modules/@npmcli/package-json": {
1041+
"version": "1.0.1",
1042+
"resolved": "https://registry.npmjs.org/@npmcli/package-json/-/package-json-1.0.1.tgz",
1043+
"integrity": "sha512-y6jnu76E9C23osz8gEMBayZmaZ69vFOIk8vR1FJL/wbEJ54+9aVG9rLTjQKSXfgYZEr50nw1txBBFfBZZe+bYg==",
1044+
"dev": true,
1045+
"dependencies": {
1046+
"json-parse-even-better-errors": "^2.3.1"
1047+
}
1048+
},
10361049
"node_modules/@npmcli/template-oss/node_modules/yaml": {
10371050
"version": "2.0.0-11",
10381051
"resolved": "https://registry.npmjs.org/yaml/-/yaml-2.0.0-11.tgz",
@@ -9521,7 +9534,7 @@
95219534
"@npmcli/move-file": "^1.1.0",
95229535
"@npmcli/name-from-folder": "^1.0.1",
95239536
"@npmcli/node-gyp": "^1.0.3",
9524-
"@npmcli/package-json": "^1.0.1",
9537+
"@npmcli/package-json": "^2.0.0",
95259538
"@npmcli/run-script": "^3.0.0",
95269539
"bin-links": "^3.0.0",
95279540
"cacache": "^16.0.0",
@@ -10193,7 +10206,7 @@
1019310206
"@npmcli/move-file": "^1.1.0",
1019410207
"@npmcli/name-from-folder": "^1.0.1",
1019510208
"@npmcli/node-gyp": "^1.0.3",
10196-
"@npmcli/package-json": "^1.0.1",
10209+
"@npmcli/package-json": "2.0.0",
1019710210
"@npmcli/run-script": "^3.0.0",
1019810211
"@npmcli/template-oss": "3.2.2",
1019910212
"benchmark": "^2.1.4",
@@ -10338,7 +10351,9 @@
1033810351
"version": "1.0.3"
1033910352
},
1034010353
"@npmcli/package-json": {
10341-
"version": "1.0.1",
10354+
"version": "2.0.0",
10355+
"resolved": "https://registry.npmjs.org/@npmcli/package-json/-/package-json-2.0.0.tgz",
10356+
"integrity": "sha512-42jnZ6yl16GzjWSH7vtrmWyJDGVa/LXPdpN2rcUWolFjc9ON2N3uz0qdBbQACfmhuJZ2lbKYtmK5qx68ZPLHMA==",
1034210357
"requires": {
1034310358
"json-parse-even-better-errors": "^2.3.1"
1034410359
}
@@ -10382,6 +10397,15 @@
1038210397
"yaml": "^2.0.0-11"
1038310398
},
1038410399
"dependencies": {
10400+
"@npmcli/package-json": {
10401+
"version": "1.0.1",
10402+
"resolved": "https://registry.npmjs.org/@npmcli/package-json/-/package-json-1.0.1.tgz",
10403+
"integrity": "sha512-y6jnu76E9C23osz8gEMBayZmaZ69vFOIk8vR1FJL/wbEJ54+9aVG9rLTjQKSXfgYZEr50nw1txBBFfBZZe+bYg==",
10404+
"dev": true,
10405+
"requires": {
10406+
"json-parse-even-better-errors": "^2.3.1"
10407+
}
10408+
},
1038510409
"yaml": {
1038610410
"version": "2.0.0-11",
1038710411
"resolved": "https://registry.npmjs.org/yaml/-/yaml-2.0.0-11.tgz",

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@
6060
"@npmcli/config": "^4.0.1",
6161
"@npmcli/fs": "^2.1.0",
6262
"@npmcli/map-workspaces": "^2.0.2",
63-
"@npmcli/package-json": "^1.0.1",
63+
"@npmcli/package-json": "^2.0.0",
6464
"@npmcli/run-script": "^3.0.1",
6565
"abbrev": "~1.1.1",
6666
"ansicolors": "~0.3.2",

workspaces/arborist/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"@npmcli/move-file": "^1.1.0",
1111
"@npmcli/name-from-folder": "^1.0.1",
1212
"@npmcli/node-gyp": "^1.0.3",
13-
"@npmcli/package-json": "^1.0.1",
13+
"@npmcli/package-json": "^2.0.0",
1414
"@npmcli/run-script": "^3.0.0",
1515
"bin-links": "^3.0.0",
1616
"cacache": "^16.0.0",

0 commit comments

Comments
 (0)