Skip to content

Commit 1f2fb1e

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

File tree

8 files changed

+200
-37
lines changed

8 files changed

+200
-37
lines changed

node_modules/@npmcli/git/lib/clone.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@ const shallowHosts = new Set([
2020
// we have to use url.parse until we add the same shim that hosted-git-info has
2121
// to handle scp:// urls
2222
const { parse } = require('url') // eslint-disable-line node/no-deprecated-api
23-
const { basename, resolve } = require('path')
23+
const path = require('path')
2424

25-
const revs = require('./revs.js')
25+
const getRevs = require('./revs.js')
2626
const spawn = require('./spawn.js')
2727
const { isWindows } = require('./utils.js')
2828

@@ -31,7 +31,7 @@ const fs = require('fs')
3131
const mkdirp = require('mkdirp')
3232

3333
module.exports = (repo, ref = 'HEAD', target = null, opts = {}) =>
34-
revs(repo, opts).then(revs => clone(
34+
getRevs(repo, opts).then(revs => clone(
3535
repo,
3636
revs,
3737
ref,
@@ -48,7 +48,7 @@ const maybeShallow = (repo, opts) => {
4848
}
4949

5050
const defaultTarget = (repo, /* istanbul ignore next */ cwd = process.cwd()) =>
51-
resolve(cwd, basename(repo.replace(/[/\\]?\.git$/, '')))
51+
path.resolve(cwd, path.basename(repo.replace(/[/\\]?\.git$/, '')))
5252

5353
const clone = (repo, revs, ref, revDoc, target, opts) => {
5454
if (!revDoc) {

node_modules/@npmcli/git/lib/lines-to-revs.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -98,19 +98,19 @@ const lineToRevDoc = line => {
9898
// ignore the pointer.
9999
// For now, though, we have to save both, because some tags
100100
// don't have peels, if they were not annotated.
101-
const ref = rawRef.substr('refs/tags/'.length)
101+
const ref = rawRef.slice('refs/tags/'.length)
102102
return { sha, ref, rawRef, type }
103103
}
104104

105105
if (type === 'branch') {
106-
const ref = rawRef.substr('refs/heads/'.length)
106+
const ref = rawRef.slice('refs/heads/'.length)
107107
return { sha, ref, rawRef, type }
108108
}
109109

110110
if (type === 'pull') {
111111
// NB: merged pull requests installable with #pull/123/merge
112112
// for the merged pr, or #pull/123 for the PR head
113-
const ref = rawRef.substr('refs/'.length).replace(/\/head$/, '')
113+
const ref = rawRef.slice('refs/'.length).replace(/\/head$/, '')
114114
return { sha, ref, rawRef, type }
115115
}
116116

node_modules/@npmcli/git/lib/spawn.js

+6-6
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,16 @@ module.exports = (gitArgs, opts = {}) => {
1717
? gitArgs
1818
: ['--no-replace-objects', ...gitArgs]
1919

20-
let retry = opts.retry
21-
if (retry === null || retry === undefined) {
22-
retry = {
20+
let retryOpts = opts.retry
21+
if (retryOpts === null || retryOpts === undefined) {
22+
retryOpts = {
2323
retries: opts.fetchRetries || 2,
2424
factor: opts.fetchRetryFactor || 10,
2525
maxTimeout: opts.fetchRetryMaxtimeout || 60000,
2626
minTimeout: opts.fetchRetryMintimeout || 1000,
2727
}
2828
}
29-
return promiseRetry((retry, number) => {
29+
return promiseRetry((retryFn, number) => {
3030
if (number !== 1) {
3131
log.silly('git', `Retrying git command: ${
3232
args.join(' ')} attempt # ${number}`)
@@ -38,7 +38,7 @@ module.exports = (gitArgs, opts = {}) => {
3838
if (!gitError.shouldRetry(number)) {
3939
throw gitError
4040
}
41-
retry(gitError)
41+
retryFn(gitError)
4242
})
43-
}, retry)
43+
}, retryOpts)
4444
}
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.
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
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+
}

node_modules/@npmcli/git/package.json

+16-16
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,43 @@
11
{
22
"name": "@npmcli/git",
3-
"version": "3.0.0",
3+
"version": "3.0.1",
44
"main": "lib/index.js",
55
"files": [
6-
"bin",
7-
"lib"
6+
"bin/",
7+
"lib/"
88
],
99
"description": "a util for spawning git from npm CLI contexts",
1010
"repository": {
1111
"type": "git",
12-
"url": "git+https://github.com./npm/git"
12+
"url": "https://github.com./npm/git.git"
1313
},
1414
"author": "GitHub Inc.",
1515
"license": "ISC",
1616
"scripts": {
17-
"lint": "eslint '**/*.js'",
18-
"lint:fix": "standard --fix",
17+
"lint": "eslint \"**/*.js\"",
1918
"postversion": "npm publish",
2019
"prepublishOnly": "git push origin --follow-tags",
2120
"preversion": "npm test",
2221
"snap": "tap",
2322
"test": "tap",
2423
"posttest": "npm run lint",
25-
"postlint": "npm-template-check",
26-
"template-copy": "npm-template-copy --force",
27-
"lintfix": "npm run lint -- --fix"
24+
"postlint": "template-oss-check",
25+
"lintfix": "npm run lint -- --fix",
26+
"template-oss-apply": "template-oss-apply --force"
2827
},
2928
"tap": {
3029
"check-coverage": true,
3130
"coverage-map": "map.js"
3231
},
3332
"devDependencies": {
34-
"@npmcli/template-oss": "^2.7.1",
33+
"@npmcli/eslint-config": "^3.0.1",
34+
"@npmcli/template-oss": "3.2.2",
3535
"slash": "^3.0.0",
36-
"standard": "^16.0.3",
37-
"tap": "^15.1.6"
36+
"tap": "^16.0.1"
3837
},
3938
"dependencies": {
40-
"@npmcli/promise-spawn": "^1.3.2",
41-
"lru-cache": "^7.3.1",
39+
"@npmcli/promise-spawn": "^3.0.0",
40+
"lru-cache": "^7.4.4",
4241
"mkdirp": "^1.0.4",
4342
"npm-pick-manifest": "^7.0.0",
4443
"proc-log": "^2.0.0",
@@ -48,10 +47,11 @@
4847
"which": "^2.0.2"
4948
},
5049
"engines": {
51-
"node": "^12.13.0 || ^14.15.0 || >=16"
50+
"node": "^12.13.0 || ^14.15.0 || >=16.0.0"
5251
},
5352
"templateOSS": {
53+
"//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.",
5454
"windowsCI": false,
55-
"version": "2.7.1"
55+
"version": "3.2.2"
5656
}
5757
}

package-lock.json

+33-8
Original file line numberDiff line numberDiff line change
@@ -881,12 +881,13 @@
881881
}
882882
},
883883
"node_modules/@npmcli/git": {
884-
"version": "3.0.0",
884+
"version": "3.0.1",
885+
"resolved": "https://registry.npmjs.org/@npmcli/git/-/git-3.0.1.tgz",
886+
"integrity": "sha512-UU85F/T+F1oVn3IsB/L6k9zXIMpXBuUBE25QDH0SsURwT6IOBqkC7M16uqo2vVZIyji3X1K4XH9luip7YekH1A==",
885887
"inBundle": true,
886-
"license": "ISC",
887888
"dependencies": {
888-
"@npmcli/promise-spawn": "^1.3.2",
889-
"lru-cache": "^7.3.1",
889+
"@npmcli/promise-spawn": "^3.0.0",
890+
"lru-cache": "^7.4.4",
890891
"mkdirp": "^1.0.4",
891892
"npm-pick-manifest": "^7.0.0",
892893
"proc-log": "^2.0.0",
@@ -896,7 +897,19 @@
896897
"which": "^2.0.2"
897898
},
898899
"engines": {
899-
"node": "^12.13.0 || ^14.15.0 || >=16"
900+
"node": "^12.13.0 || ^14.15.0 || >=16.0.0"
901+
}
902+
},
903+
"node_modules/@npmcli/git/node_modules/@npmcli/promise-spawn": {
904+
"version": "3.0.0",
905+
"resolved": "https://registry.npmjs.org/@npmcli/promise-spawn/-/promise-spawn-3.0.0.tgz",
906+
"integrity": "sha512-s9SgS+p3a9Eohe68cSI3fi+hpcZUmXq5P7w0kMlAsWVtR7XbK3ptkZqKT2cK1zLDObJ3sR+8P59sJE0w/KTL1g==",
907+
"inBundle": true,
908+
"dependencies": {
909+
"infer-owner": "^1.0.4"
910+
},
911+
"engines": {
912+
"node": "^12.13.0 || ^14.15.0 || >=16.0.0"
900913
}
901914
},
902915
"node_modules/@npmcli/installed-package-contents": {
@@ -10329,17 +10342,29 @@
1032910342
}
1033010343
},
1033110344
"@npmcli/git": {
10332-
"version": "3.0.0",
10345+
"version": "3.0.1",
10346+
"resolved": "https://registry.npmjs.org/@npmcli/git/-/git-3.0.1.tgz",
10347+
"integrity": "sha512-UU85F/T+F1oVn3IsB/L6k9zXIMpXBuUBE25QDH0SsURwT6IOBqkC7M16uqo2vVZIyji3X1K4XH9luip7YekH1A==",
1033310348
"requires": {
10334-
"@npmcli/promise-spawn": "^1.3.2",
10335-
"lru-cache": "^7.3.1",
10349+
"@npmcli/promise-spawn": "^3.0.0",
10350+
"lru-cache": "^7.4.4",
1033610351
"mkdirp": "^1.0.4",
1033710352
"npm-pick-manifest": "^7.0.0",
1033810353
"proc-log": "^2.0.0",
1033910354
"promise-inflight": "^1.0.1",
1034010355
"promise-retry": "^2.0.1",
1034110356
"semver": "^7.3.5",
1034210357
"which": "^2.0.2"
10358+
},
10359+
"dependencies": {
10360+
"@npmcli/promise-spawn": {
10361+
"version": "3.0.0",
10362+
"resolved": "https://registry.npmjs.org/@npmcli/promise-spawn/-/promise-spawn-3.0.0.tgz",
10363+
"integrity": "sha512-s9SgS+p3a9Eohe68cSI3fi+hpcZUmXq5P7w0kMlAsWVtR7XbK3ptkZqKT2cK1zLDObJ3sR+8P59sJE0w/KTL1g==",
10364+
"requires": {
10365+
"infer-owner": "^1.0.4"
10366+
}
10367+
}
1034310368
}
1034410369
},
1034510370
"@npmcli/installed-package-contents": {

0 commit comments

Comments
 (0)