Skip to content

Commit c23ee37

Browse files
ruyadornocodebytere
authored andcommitted
deps: upgrade npm to 7.0.12
PR-URL: #36153 Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Rich Trott <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]> Reviewed-By: Gireesh Punathil <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Trivikram Kamat <[email protected]>
1 parent 4e3883e commit c23ee37

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

111 files changed

+5022
-3247
lines changed

deps/npm/.eslintrc.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@
133133
"no-shadow-restricted-names": "error",
134134
"no-sparse-arrays": "error",
135135
"no-tabs": "error",
136-
"no-template-curly-in-string": "error",
136+
"no-template-curly-in-string": "off",
137137
"no-this-before-super": "error",
138138
"no-throw-literal": "off",
139139
"no-trailing-spaces": "error",

deps/npm/AUTHORS

+1
Original file line numberDiff line numberDiff line change
@@ -733,3 +733,4 @@ Jan Tojnar <[email protected]>
733733
Jason Attwood <[email protected]>
734734
Vlad GURDIGA <[email protected]>
735735
Sébastien Puech <[email protected]>
736+
Jannis Hell <[email protected]>

deps/npm/CHANGELOG.md

+27
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,30 @@
1+
## 7.0.12 (2020-11-17)
2+
3+
### BUG FIXES
4+
5+
* [`7b89576bd`](https://github.com/npm/cli/commit/7b89576bd1fa557a312a841afa66b895558d1b12)
6+
[#2174](https://github.com/npm/cli/issues/2174)
7+
fix running empty scripts with `npm run-script`
8+
([@nlf](https://github.com/nlf))
9+
* [`bc9afb195`](https://github.com/npm/cli/commit/bc9afb195f5aad7c06bc96049c0f00dc8e752dee)
10+
[#2002](https://github.com/npm/cli/issues/2002)
11+
[#2184](https://github.com/npm/cli/issues/2184)
12+
Preserve builtin conf when installing npm globally
13+
([@isaacs](https://github.com/isaacs))
14+
15+
### DEPENDENCIES
16+
17+
* [`b74c05d88`](https://github.com/npm/cli/commit/b74c05d88dc48fabef031ea66ffaa4e548845655)
18+
19+
* fix windows command-line argument escaping
20+
21+
### DOCUMENTATION
22+
23+
* [`4e522fdc9`](https://github.com/npm/cli/commit/4e522fdc917bc85af2ca8ff7669a0178e2f35123)
24+
[#2179](https://github.com/npm/cli/issues/2179)
25+
remove mention to --parseable option from `npm audit` docs
26+
([@Primajin](https://github.com/Primajin))
27+
128
## 7.0.11 (2020-11-13)
229

330
### DEPENDENCIES

deps/npm/docs/content/commands/npm-audit.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ description: Run a security audit
77
### Synopsis
88

99
```bash
10-
npm audit [--json|--parseable|--audit-level=(low|moderate|high|critical)]
11-
npm audit fix [--force|--package-lock-only|--dry-run]
10+
npm audit [--json] [--production] [--audit-level=(low|moderate|high|critical)]
11+
npm audit fix [--force|--package-lock-only|--dry-run|--production|--only=(dev|prod)]
1212

1313
common options: [--production] [--only=(dev|prod)]
1414
```

deps/npm/docs/output/commands/npm-audit.html

+2-2
Original file line numberDiff line numberDiff line change
@@ -145,8 +145,8 @@ <h2 id="table-of-contents">Table of contents</h2>
145145
</section>
146146

147147
<div id="_content"><h3 id="synopsis">Synopsis</h3>
148-
<pre lang="bash"><code>npm audit [--json|--parseable|--audit-level=(low|moderate|high|critical)]
149-
npm audit fix [--force|--package-lock-only|--dry-run]
148+
<pre lang="bash"><code>npm audit [--json] [--production] [--audit-level=(low|moderate|high|critical)]
149+
npm audit fix [--force|--package-lock-only|--dry-run|--production|--only=(dev|prod)]
150150

151151
common options: [--production] [--only=(dev|prod)]
152152
</code></pre>

deps/npm/docs/output/commands/npm-ls.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ <h3 id="description">Description</h3>
156156
limit the results to only the paths to the packages named. Note that
157157
nested packages will <em>also</em> show the paths to the specified packages.
158158
For example, running <code>npm ls promzard</code> in npm’s source tree will show:</p>
159-
<pre lang="bash"><code> [email protected].11 /path/to/npm
159+
<pre lang="bash"><code> [email protected].12 /path/to/npm
160160
161161
162162
</code></pre>

deps/npm/docs/output/commands/npm.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ <h2 id="table-of-contents">Table of contents</h2>
148148
<pre lang="bash"><code>npm &lt;command&gt; [args]
149149
</code></pre>
150150
<h3 id="version">Version</h3>
151-
<p>7.0.11</p>
151+
<p>7.0.12</p>
152152
<h3 id="description">Description</h3>
153153
<p>npm is the package manager for the Node JavaScript platform. It puts
154154
modules in place so that node can find them, and manages dependency

deps/npm/lib/audit.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ const Arborist = require('@npmcli/arborist')
22
const auditReport = require('npm-audit-report')
33
const npm = require('./npm.js')
44
const output = require('./utils/output.js')
5-
const reifyOutput = require('./utils/reify-output.js')
5+
const reifyFinish = require('./utils/reify-finish.js')
66
const auditError = require('./utils/audit-error.js')
77

88
const audit = async args => {
@@ -14,7 +14,7 @@ const audit = async args => {
1414
const fix = args[0] === 'fix'
1515
await arb.audit({ fix })
1616
if (fix)
17-
reifyOutput(arb)
17+
await reifyFinish(arb)
1818
else {
1919
// will throw if there's an error, because this is an audit command
2020
auditError(arb.auditReport)

deps/npm/lib/ci.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
const util = require('util')
22
const Arborist = require('@npmcli/arborist')
33
const rimraf = util.promisify(require('rimraf'))
4-
const reifyOutput = require('./utils/reify-output.js')
4+
const reifyFinish = require('./utils/reify-finish.js')
55

66
const log = require('npmlog')
77
const npm = require('./npm.js')
@@ -35,7 +35,7 @@ const ci = async () => {
3535
])
3636
// npm ci should never modify the lockfile or package.json
3737
await arb.reify({ ...npm.flatOptions, save: false })
38-
reifyOutput(arb)
38+
await reifyFinish(arb)
3939
}
4040

4141
module.exports = Object.assign(cmd, { completion, usage })

deps/npm/lib/dedupe.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
const npm = require('./npm.js')
33
const Arborist = require('@npmcli/arborist')
44
const usageUtil = require('./utils/usage.js')
5-
const reifyOutput = require('./utils/reify-output.js')
5+
const reifyFinish = require('./utils/reify-finish.js')
66

77
const usage = usageUtil('dedupe', 'npm dedupe')
88
const completion = require('./utils/completion/none.js')
@@ -18,7 +18,7 @@ const dedupe = async (args) => {
1818
dryRun,
1919
})
2020
await arb.dedupe(npm.flatOptions)
21-
reifyOutput(arb)
21+
await reifyFinish(arb)
2222
}
2323

2424
module.exports = Object.assign(cmd, { usage, completion })

deps/npm/lib/init.js

+8-7
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
// initialize a package.json file
2-
3-
const usageUtil = require('./utils/usage.js')
4-
const completion = require('./utils/completion/none.js')
1+
'use strict'
52

3+
const initJson = require('init-package-json')
64
const npa = require('npm-package-arg')
5+
76
const npm = require('./npm.js')
8-
const initJson = require('init-package-json')
7+
const usageUtil = require('./utils/usage.js')
8+
const completion = require('./utils/completion/none.js')
99
const output = require('./utils/output.js')
1010

1111
const usage = usageUtil(
@@ -78,11 +78,12 @@ const init = async args => {
7878
npm.log.warn('init', 'canceled')
7979
return res()
8080
}
81-
npm.log.info('init', 'written successfully')
8281
if (er)
8382
rej(er)
84-
else
83+
else {
84+
npm.log.info('init', 'written successfully')
8585
res(data)
86+
}
8687
})
8788
})
8889
}

deps/npm/lib/install.js

+30-33
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,15 @@ const util = require('util')
66
const readdir = util.promisify(fs.readdir)
77
const npm = require('./npm.js')
88
const usageUtil = require('./utils/usage.js')
9-
const reifyOutput = require('./utils/reify-output.js')
9+
const reifyFinish = require('./utils/reify-finish.js')
1010
const log = require('npmlog')
1111
const { resolve, join } = require('path')
1212
const Arborist = require('@npmcli/arborist')
1313
const runScript = require('@npmcli/run-script')
1414

15-
const install = async (args, cb) => {
15+
const cmd = async (args, cb) => install(args).then(() => cb()).catch(cb)
16+
17+
const install = async args => {
1618
// the /path/to/node_modules/..
1719
const globalTop = resolve(npm.globalDir, '..')
1820
const { ignoreScripts, global: isGlobalInstall } = npm.flatOptions
@@ -34,38 +36,33 @@ const install = async (args, cb) => {
3436
path: where,
3537
})
3638

37-
try {
38-
await arb.reify({
39-
...npm.flatOptions,
40-
add: args,
41-
})
42-
if (!args.length && !isGlobalInstall && !ignoreScripts) {
43-
const { scriptShell } = npm.flatOptions
44-
const scripts = [
45-
'preinstall',
46-
'install',
47-
'postinstall',
48-
'prepublish', // XXX should we remove this finally??
49-
'preprepare',
50-
'prepare',
51-
'postprepare',
52-
]
53-
for (const event of scripts) {
54-
await runScript({
55-
path: where,
56-
args: [],
57-
scriptShell,
58-
stdio: 'inherit',
59-
stdioString: true,
60-
event,
61-
})
62-
}
39+
await arb.reify({
40+
...npm.flatOptions,
41+
add: args,
42+
})
43+
if (!args.length && !isGlobalInstall && !ignoreScripts) {
44+
const { scriptShell } = npm.flatOptions
45+
const scripts = [
46+
'preinstall',
47+
'install',
48+
'postinstall',
49+
'prepublish', // XXX should we remove this finally??
50+
'preprepare',
51+
'prepare',
52+
'postprepare',
53+
]
54+
for (const event of scripts) {
55+
await runScript({
56+
path: where,
57+
args: [],
58+
scriptShell,
59+
stdio: 'inherit',
60+
stdioString: true,
61+
event,
62+
})
6363
}
64-
reifyOutput(arb)
65-
cb()
66-
} catch (er) {
67-
cb(er)
6864
}
65+
await reifyFinish(arb)
6966
}
7067

7168
const usage = usageUtil(
@@ -144,4 +141,4 @@ const completion = async (opts, cb) => {
144141
cb()
145142
}
146143

147-
module.exports = Object.assign(install, { usage, completion })
144+
module.exports = Object.assign(cmd, { usage, completion })

deps/npm/lib/link.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ const semver = require('semver')
1010

1111
const npm = require('./npm.js')
1212
const usageUtil = require('./utils/usage.js')
13-
const reifyOutput = require('./utils/reify-output.js')
13+
const reifyFinish = require('./utils/reify-finish.js')
1414

1515
const completion = (opts, cb) => {
1616
const dir = npm.globalDir
@@ -122,7 +122,7 @@ const linkInstall = async args => {
122122
add: names.map(l => `file:${resolve(globalTop, 'node_modules', l)}`),
123123
})
124124

125-
reifyOutput(localArb)
125+
await reifyFinish(localArb)
126126
}
127127

128128
const linkPkg = async () => {
@@ -133,7 +133,7 @@ const linkPkg = async () => {
133133
global: true,
134134
})
135135
await arb.reify({ add: [`file:${npm.prefix}`] })
136-
reifyOutput(arb)
136+
await reifyFinish(arb)
137137
}
138138

139139
module.exports = Object.assign(cmd, { completion, usage })

deps/npm/lib/prune.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ const npm = require('./npm.js')
33
const Arborist = require('@npmcli/arborist')
44
const usageUtil = require('./utils/usage.js')
55

6-
const reifyOutput = require('./utils/reify-output.js')
6+
const reifyFinish = require('./utils/reify-finish.js')
77

88
const usage = usageUtil('prune',
99
'npm prune [[<@scope>/]<pkg>...] [--production]'
@@ -19,7 +19,7 @@ const prune = async () => {
1919
path: where,
2020
})
2121
await arb.prune(npm.flatOptions)
22-
reifyOutput(arb)
22+
await reifyFinish(arb)
2323
}
2424

2525
module.exports = Object.assign(cmd, { usage, completion })

deps/npm/lib/run-script.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ const runScript = async (args) => {
4646

4747
pkg.scripts = scripts
4848

49-
if (!scripts[event] && !(event === 'start' && await isServerPackage(path))) {
49+
if (!Object.prototype.hasOwnProperty.call(scripts, event) && !(event === 'start' && await isServerPackage(path))) {
5050
if (npm.config.get('if-present'))
5151
return
5252

deps/npm/lib/uninstall.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ const npm = require('./npm.js')
55
const rpj = require('read-package-json-fast')
66
const { resolve } = require('path')
77
const usageUtil = require('./utils/usage.js')
8-
const reifyOutput = require('./utils/reify-output.js')
8+
const reifyFinish = require('./utils/reify-finish.js')
99

1010
const cmd = (args, cb) => rm(args).then(() => cb()).catch(cb)
1111

@@ -32,7 +32,7 @@ const rm = async args => {
3232
...npm.flatOptions,
3333
rm: args,
3434
})
35-
reifyOutput(arb)
35+
await reifyFinish(arb)
3636
}
3737

3838
const usage = usageUtil(

deps/npm/lib/update.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ const Arborist = require('@npmcli/arborist')
44
const log = require('npmlog')
55
const npm = require('./npm.js')
66
const usageUtil = require('./utils/usage.js')
7-
const reifyOutput = require('./utils/reify-output.js')
7+
const reifyFinish = require('./utils/reify-finish.js')
88
const completion = require('./utils/completion/installed-deep.js')
99

1010
const usage = usageUtil(
@@ -32,7 +32,7 @@ const update = async args => {
3232
})
3333

3434
await arb.reify({ update })
35-
reifyOutput(arb)
35+
await reifyFinish(arb)
3636
}
3737

3838
module.exports = Object.assign(cmd, { usage, completion })

deps/npm/lib/utils/reify-finish.js

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
const reifyOutput = require('./reify-output.js')
2+
const npm = require('../npm.js')
3+
const ini = require('ini')
4+
const {writeFile} = require('fs').promises
5+
const {resolve} = require('path')
6+
7+
const reifyFinish = async arb => {
8+
await saveBuiltinConfig(arb)
9+
reifyOutput(arb)
10+
}
11+
12+
const saveBuiltinConfig = async arb => {
13+
const { options: { global }, actualTree } = arb
14+
if (!global)
15+
return
16+
17+
// if we are using a builtin config, and just installed npm as
18+
// a top-level global package, we have to preserve that config.
19+
const npmNode = actualTree.inventory.get('node_modules/npm')
20+
if (!npmNode)
21+
return
22+
23+
const builtinConf = npm.config.data.get('builtin')
24+
if (builtinConf.loadError)
25+
return
26+
27+
const content = ini.stringify(builtinConf.raw).trim() + '\n'
28+
await writeFile(resolve(npmNode.path, 'npmrc'), content)
29+
}
30+
31+
module.exports = reifyFinish

deps/npm/man/man1/npm-audit.1

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
.P
66
.RS 2
77
.nf
8-
npm audit [\-\-json|\-\-parseable|\-\-audit\-level=(low|moderate|high|critical)]
9-
npm audit fix [\-\-force|\-\-package\-lock\-only|\-\-dry\-run]
8+
npm audit [\-\-json] [\-\-production] [\-\-audit\-level=(low|moderate|high|critical)]
9+
npm audit fix [\-\-force|\-\-package\-lock\-only|\-\-dry\-run|\-\-production|\-\-only=(dev|prod)]
1010

1111
common options: [\-\-production] [\-\-only=(dev|prod)]
1212
.fi

0 commit comments

Comments
 (0)