Skip to content

Commit 0f23c33

Browse files
committed
deps: @npmcli/[email protected]
1 parent 1f2fb1e commit 0f23c33

File tree

9 files changed

+263
-25
lines changed

9 files changed

+263
-25
lines changed

node_modules/@npmcli/run-script/lib/run-script.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ const runScript = options => {
77
validateOptions(options)
88
const { pkg, path } = options
99
return pkg ? runScriptPkg(options)
10-
: rpj(path + '/package.json').then(pkg => runScriptPkg({ ...options, pkg }))
10+
: rpj(path + '/package.json')
11+
.then(readPackage => runScriptPkg({ ...options, pkg: readPackage }))
1112
}
1213

1314
module.exports = Object.assign(runScript, { isServerPackage })

node_modules/@npmcli/run-script/lib/set-path.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ const setPATH = (projectPath, env) => {
1212
const delimiter = isWindows ? ';' : ':'
1313
const PATH = Object.keys(env).filter(p => /^path$/i.test(p) && env[p])
1414
.map(p => env[p].split(delimiter))
15-
.reduce((set, p) => set.concat(p.filter(p => !set.includes(p))), [])
15+
.reduce((set, p) => set.concat(p.filter(concatted => !set.includes(concatted))), [])
1616
.join(delimiter)
1717

1818
const pathArr = []
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
const util = require('util')
2+
const fs = require('fs')
3+
const { stat } = fs.promises || { stat: util.promisify(fs.stat) }
4+
5+
async function isNodeGypPackage (path) {
6+
return await stat(`${path}/binding.gyp`)
7+
.then(st => st.isFile())
8+
.catch(() => false)
9+
}
10+
11+
module.exports = {
12+
isNodeGypPackage,
13+
defaultGypInstallScript: 'node-gyp rebuild',
14+
}
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
{
2+
"name": "@npmcli/node-gyp",
3+
"version": "2.0.0",
4+
"description": "Tools for dealing with node-gyp packages",
5+
"scripts": {
6+
"test": "tap",
7+
"preversion": "npm test",
8+
"postversion": "npm publish",
9+
"prepublishOnly": "git push origin --follow-tags",
10+
"lint": "eslint \"**/*.js\"",
11+
"postlint": "template-oss-check",
12+
"template-oss-apply": "template-oss-apply --force",
13+
"lintfix": "npm run lint -- --fix",
14+
"snap": "tap",
15+
"posttest": "npm run lint"
16+
},
17+
"repository": {
18+
"type": "git",
19+
"url": "https://github.com/npm/node-gyp.git"
20+
},
21+
"keywords": [
22+
"npm",
23+
"cli",
24+
"node-gyp"
25+
],
26+
"files": [
27+
"bin/",
28+
"lib/"
29+
],
30+
"main": "lib/index.js",
31+
"author": "GitHub Inc.",
32+
"license": "ISC",
33+
"devDependencies": {
34+
"@npmcli/eslint-config": "^3.0.1",
35+
"@npmcli/template-oss": "3.2.2",
36+
"tap": "^16.0.1"
37+
},
38+
"engines": {
39+
"node": "^12.13.0 || ^14.15.0 || >=16.0.0"
40+
},
41+
"templateOSS": {
42+
"//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.",
43+
"version": "3.2.2"
44+
}
45+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
The ISC License
2+
3+
Copyright (c) npm, Inc.
4+
5+
Permission to use, copy, modify, and/or distribute this software for any
6+
purpose with or without fee is hereby granted, provided that the above
7+
copyright notice and this permission notice appear in all copies.
8+
9+
THE SOFTWARE IS PROVIDED "AS IS" AND THE NPM DISCLAIMS ALL WARRANTIES WITH
10+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
11+
FITNESS. IN NO EVENT SHALL THE NPM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT,
12+
OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
13+
DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
14+
ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
15+
SOFTWARE.
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
const { spawn } = require('child_process')
2+
const inferOwner = require('infer-owner')
3+
4+
const isPipe = (stdio = 'pipe', fd) =>
5+
stdio === 'pipe' || stdio === null ? true
6+
: Array.isArray(stdio) ? isPipe(stdio[fd], fd)
7+
: false
8+
9+
// 'extra' object is for decorating the error a bit more
10+
const promiseSpawn = (cmd, args, opts = {}, extra = {}) => {
11+
const cwd = opts.cwd || process.cwd()
12+
const isRoot = process.getuid && process.getuid() === 0
13+
const { uid, gid } = isRoot ? inferOwner.sync(cwd) : {}
14+
return promiseSpawnUid(cmd, args, {
15+
...opts,
16+
cwd,
17+
uid,
18+
gid,
19+
}, extra)
20+
}
21+
22+
const stdioResult = (stdout, stderr, { stdioString, stdio }) =>
23+
stdioString ? {
24+
stdout: isPipe(stdio, 1) ? Buffer.concat(stdout).toString() : null,
25+
stderr: isPipe(stdio, 2) ? Buffer.concat(stderr).toString() : null,
26+
}
27+
: {
28+
stdout: isPipe(stdio, 1) ? Buffer.concat(stdout) : null,
29+
stderr: isPipe(stdio, 2) ? Buffer.concat(stderr) : null,
30+
}
31+
32+
const promiseSpawnUid = (cmd, args, opts, extra) => {
33+
let proc
34+
const p = new Promise((res, rej) => {
35+
proc = spawn(cmd, args, opts)
36+
const stdout = []
37+
const stderr = []
38+
const reject = er => rej(Object.assign(er, {
39+
cmd,
40+
args,
41+
...stdioResult(stdout, stderr, opts),
42+
...extra,
43+
}))
44+
proc.on('error', reject)
45+
if (proc.stdout) {
46+
proc.stdout.on('data', c => stdout.push(c)).on('error', reject)
47+
proc.stdout.on('error', er => reject(er))
48+
}
49+
if (proc.stderr) {
50+
proc.stderr.on('data', c => stderr.push(c)).on('error', reject)
51+
proc.stderr.on('error', er => reject(er))
52+
}
53+
proc.on('close', (code, signal) => {
54+
const result = {
55+
cmd,
56+
args,
57+
code,
58+
signal,
59+
...stdioResult(stdout, stderr, opts),
60+
...extra,
61+
}
62+
if (code || signal) {
63+
rej(Object.assign(new Error('command failed'), result))
64+
} else {
65+
res(result)
66+
}
67+
})
68+
})
69+
70+
p.stdin = proc.stdin
71+
p.process = proc
72+
return p
73+
}
74+
75+
module.exports = promiseSpawn
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
{
2+
"name": "@npmcli/promise-spawn",
3+
"version": "3.0.0",
4+
"files": [
5+
"bin/",
6+
"lib/"
7+
],
8+
"main": "./lib/index.js",
9+
"description": "spawn processes the way the npm cli likes to do",
10+
"repository": {
11+
"type": "git",
12+
"url": "https://github.com/npm/promise-spawn.git"
13+
},
14+
"author": "GitHub Inc.",
15+
"license": "ISC",
16+
"scripts": {
17+
"test": "tap",
18+
"snap": "tap",
19+
"preversion": "npm test",
20+
"postversion": "npm publish",
21+
"prepublishOnly": "git push origin --follow-tags",
22+
"lint": "eslint \"**/*.js\"",
23+
"lintfix": "npm run lint -- --fix",
24+
"posttest": "npm run lint",
25+
"postsnap": "npm run lintfix --",
26+
"postlint": "template-oss-check",
27+
"template-oss-apply": "template-oss-apply --force"
28+
},
29+
"tap": {
30+
"check-coverage": true
31+
},
32+
"devDependencies": {
33+
"@npmcli/eslint-config": "^3.0.1",
34+
"@npmcli/template-oss": "3.2.2",
35+
"minipass": "^3.1.1",
36+
"tap": "^16.0.1"
37+
},
38+
"engines": {
39+
"node": "^12.13.0 || ^14.15.0 || >=16.0.0"
40+
},
41+
"templateOSS": {
42+
"//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.",
43+
"version": "3.2.2"
44+
},
45+
"dependencies": {
46+
"infer-owner": "^1.0.4"
47+
}
48+
}
Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@npmcli/run-script",
3-
"version": "3.0.1",
3+
"version": "3.0.2",
44
"description": "Run a lifecycle script for a package (descendant of npm-lifecycle)",
55
"author": "GitHub Inc.",
66
"license": "ISC",
@@ -10,42 +10,44 @@
1010
"postversion": "npm publish",
1111
"prepublishOnly": "git push origin --follow-tags",
1212
"eslint": "eslint",
13-
"lint": "eslint '**/*.js'",
13+
"lint": "eslint \"**/*.js\"",
1414
"lintfix": "npm run lint -- --fix",
15-
"postlint": "npm-template-check",
16-
"template-copy": "npm-template-copy --force",
15+
"postlint": "template-oss-check",
1716
"snap": "tap",
18-
"posttest": "npm run lint"
17+
"posttest": "npm run lint",
18+
"template-oss-apply": "template-oss-apply --force"
1919
},
2020
"tap": {
2121
"check-coverage": true,
2222
"coverage-map": "map.js"
2323
},
2424
"devDependencies": {
25-
"@npmcli/template-oss": "^2.9.1",
25+
"@npmcli/eslint-config": "^3.0.1",
26+
"@npmcli/template-oss": "3.2.2",
2627
"minipass": "^3.1.6",
2728
"require-inject": "^1.4.4",
28-
"tap": "^15.1.6"
29+
"tap": "^16.0.1"
2930
},
3031
"dependencies": {
31-
"@npmcli/node-gyp": "^1.0.3",
32-
"@npmcli/promise-spawn": "^1.3.2",
32+
"@npmcli/node-gyp": "^2.0.0",
33+
"@npmcli/promise-spawn": "^3.0.0",
3334
"node-gyp": "^9.0.0",
3435
"read-package-json-fast": "^2.0.3"
3536
},
3637
"files": [
37-
"bin",
38-
"lib"
38+
"bin/",
39+
"lib/"
3940
],
4041
"main": "lib/run-script.js",
4142
"repository": {
4243
"type": "git",
43-
"url": "git+https://github.com/npm/run-script.git"
44+
"url": "https://github.com/npm/run-script.git"
4445
},
4546
"engines": {
46-
"node": "^12.13.0 || ^14.15.0 || >=16"
47+
"node": "^12.13.0 || ^14.15.0 || >=16.0.0"
4748
},
4849
"templateOSS": {
49-
"version": "2.9.1"
50+
"//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.",
51+
"version": "3.2.2"
5052
}
5153
}

package-lock.json

Lines changed: 47 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -993,7 +993,6 @@
993993
},
994994
"node_modules/@npmcli/node-gyp": {
995995
"version": "1.0.3",
996-
"inBundle": true,
997996
"license": "ISC"
998997
},
999998
"node_modules/@npmcli/package-json": {
@@ -1018,17 +1017,39 @@
10181017
}
10191018
},
10201019
"node_modules/@npmcli/run-script": {
1021-
"version": "3.0.1",
1020+
"version": "3.0.2",
1021+
"resolved": "https://registry.npmjs.org/@npmcli/run-script/-/run-script-3.0.2.tgz",
1022+
"integrity": "sha512-vdjD/PMBl+OX9j9C9irx5sCCIKfp2PWkpPNH9zxvlJAfSZ3Qp5aU412v+O3PFJl3R1PFNwuyChCqHg4ma6ci2Q==",
10221023
"inBundle": true,
1023-
"license": "ISC",
10241024
"dependencies": {
1025-
"@npmcli/node-gyp": "^1.0.3",
1026-
"@npmcli/promise-spawn": "^1.3.2",
1025+
"@npmcli/node-gyp": "^2.0.0",
1026+
"@npmcli/promise-spawn": "^3.0.0",
10271027
"node-gyp": "^9.0.0",
10281028
"read-package-json-fast": "^2.0.3"
10291029
},
10301030
"engines": {
1031-
"node": "^12.13.0 || ^14.15.0 || >=16"
1031+
"node": "^12.13.0 || ^14.15.0 || >=16.0.0"
1032+
}
1033+
},
1034+
"node_modules/@npmcli/run-script/node_modules/@npmcli/node-gyp": {
1035+
"version": "2.0.0",
1036+
"resolved": "https://registry.npmjs.org/@npmcli/node-gyp/-/node-gyp-2.0.0.tgz",
1037+
"integrity": "sha512-doNI35wIe3bBaEgrlPfdJPaCpUR89pJWep4Hq3aRdh6gKazIVWfs0jHttvSSoq47ZXgC7h73kDsUl8AoIQUB+A==",
1038+
"inBundle": true,
1039+
"engines": {
1040+
"node": "^12.13.0 || ^14.15.0 || >=16.0.0"
1041+
}
1042+
},
1043+
"node_modules/@npmcli/run-script/node_modules/@npmcli/promise-spawn": {
1044+
"version": "3.0.0",
1045+
"resolved": "https://registry.npmjs.org/@npmcli/promise-spawn/-/promise-spawn-3.0.0.tgz",
1046+
"integrity": "sha512-s9SgS+p3a9Eohe68cSI3fi+hpcZUmXq5P7w0kMlAsWVtR7XbK3ptkZqKT2cK1zLDObJ3sR+8P59sJE0w/KTL1g==",
1047+
"inBundle": true,
1048+
"dependencies": {
1049+
"infer-owner": "^1.0.4"
1050+
},
1051+
"engines": {
1052+
"node": "^12.13.0 || ^14.15.0 || >=16.0.0"
10321053
}
10331054
},
10341055
"node_modules/@npmcli/template-oss": {
@@ -10438,12 +10459,29 @@
1043810459
}
1043910460
},
1044010461
"@npmcli/run-script": {
10441-
"version": "3.0.1",
10462+
"version": "3.0.2",
10463+
"resolved": "https://registry.npmjs.org/@npmcli/run-script/-/run-script-3.0.2.tgz",
10464+
"integrity": "sha512-vdjD/PMBl+OX9j9C9irx5sCCIKfp2PWkpPNH9zxvlJAfSZ3Qp5aU412v+O3PFJl3R1PFNwuyChCqHg4ma6ci2Q==",
1044210465
"requires": {
10443-
"@npmcli/node-gyp": "^1.0.3",
10444-
"@npmcli/promise-spawn": "^1.3.2",
10466+
"@npmcli/node-gyp": "^2.0.0",
10467+
"@npmcli/promise-spawn": "^3.0.0",
1044510468
"node-gyp": "^9.0.0",
1044610469
"read-package-json-fast": "^2.0.3"
10470+
},
10471+
"dependencies": {
10472+
"@npmcli/node-gyp": {
10473+
"version": "2.0.0",
10474+
"resolved": "https://registry.npmjs.org/@npmcli/node-gyp/-/node-gyp-2.0.0.tgz",
10475+
"integrity": "sha512-doNI35wIe3bBaEgrlPfdJPaCpUR89pJWep4Hq3aRdh6gKazIVWfs0jHttvSSoq47ZXgC7h73kDsUl8AoIQUB+A=="
10476+
},
10477+
"@npmcli/promise-spawn": {
10478+
"version": "3.0.0",
10479+
"resolved": "https://registry.npmjs.org/@npmcli/promise-spawn/-/promise-spawn-3.0.0.tgz",
10480+
"integrity": "sha512-s9SgS+p3a9Eohe68cSI3fi+hpcZUmXq5P7w0kMlAsWVtR7XbK3ptkZqKT2cK1zLDObJ3sR+8P59sJE0w/KTL1g==",
10481+
"requires": {
10482+
"infer-owner": "^1.0.4"
10483+
}
10484+
}
1044710485
}
1044810486
},
1044910487
"@npmcli/template-oss": {

0 commit comments

Comments
 (0)