Skip to content

Commit

Permalink
deps: upgrade npm to 7.0.12
Browse files Browse the repository at this point in the history
PR-URL: #36153
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
  • Loading branch information
ruyadorno authored and codebytere committed Nov 22, 2020
1 parent 4e3883e commit c23ee37
Show file tree
Hide file tree
Showing 111 changed files with 5,022 additions and 3,247 deletions.
2 changes: 1 addition & 1 deletion deps/npm/.eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@
"no-shadow-restricted-names": "error",
"no-sparse-arrays": "error",
"no-tabs": "error",
"no-template-curly-in-string": "error",
"no-template-curly-in-string": "off",
"no-this-before-super": "error",
"no-throw-literal": "off",
"no-trailing-spaces": "error",
Expand Down
1 change: 1 addition & 0 deletions deps/npm/AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -733,3 +733,4 @@ Jan Tojnar <jtojnar@gmail.com>
Jason Attwood <jason_attwood@hotmail.co.uk>
Vlad GURDIGA <gurdiga@gmail.com>
Sébastien Puech <s.puech@tricentis.com>
Jannis Hell <Primajin@users.noreply.github.com>
27 changes: 27 additions & 0 deletions deps/npm/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,30 @@
## 7.0.12 (2020-11-17)

### BUG FIXES

* [`7b89576bd`](https://github.com/npm/cli/commit/7b89576bd1fa557a312a841afa66b895558d1b12)
[#2174](https://github.com/npm/cli/issues/2174)
fix running empty scripts with `npm run-script`
([@nlf](https://github.com/nlf))
* [`bc9afb195`](https://github.com/npm/cli/commit/bc9afb195f5aad7c06bc96049c0f00dc8e752dee)
[#2002](https://github.com/npm/cli/issues/2002)
[#2184](https://github.com/npm/cli/issues/2184)
Preserve builtin conf when installing npm globally
([@isaacs](https://github.com/isaacs))

### DEPENDENCIES

* [`b74c05d88`](https://github.com/npm/cli/commit/b74c05d88dc48fabef031ea66ffaa4e548845655)
`@npmcli/run-script@1.8.0`
* fix windows command-line argument escaping

### DOCUMENTATION

* [`4e522fdc9`](https://github.com/npm/cli/commit/4e522fdc917bc85af2ca8ff7669a0178e2f35123)
[#2179](https://github.com/npm/cli/issues/2179)
remove mention to --parseable option from `npm audit` docs
([@Primajin](https://github.com/Primajin))

## 7.0.11 (2020-11-13)

### DEPENDENCIES
Expand Down
4 changes: 2 additions & 2 deletions deps/npm/docs/content/commands/npm-audit.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ description: Run a security audit
### Synopsis

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

common options: [--production] [--only=(dev|prod)]
```
Expand Down
4 changes: 2 additions & 2 deletions deps/npm/docs/output/commands/npm-audit.html
Original file line number Diff line number Diff line change
Expand Up @@ -145,8 +145,8 @@ <h2 id="table-of-contents">Table of contents</h2>
</section>

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

common options: [--production] [--only=(dev|prod)]
</code></pre>
Expand Down
2 changes: 1 addition & 1 deletion deps/npm/docs/output/commands/npm-ls.html
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ <h3 id="description">Description</h3>
limit the results to only the paths to the packages named. Note that
nested packages will <em>also</em> show the paths to the specified packages.
For example, running <code>npm ls promzard</code> in npm’s source tree will show:</p>
<pre lang="bash"><code> npm@7.0.11 /path/to/npm
<pre lang="bash"><code> npm@7.0.12 /path/to/npm
└─┬ init-package-json@0.0.4
└── promzard@0.1.5
</code></pre>
Expand Down
2 changes: 1 addition & 1 deletion deps/npm/docs/output/commands/npm.html
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ <h2 id="table-of-contents">Table of contents</h2>
<pre lang="bash"><code>npm &lt;command&gt; [args]
</code></pre>
<h3 id="version">Version</h3>
<p>7.0.11</p>
<p>7.0.12</p>
<h3 id="description">Description</h3>
<p>npm is the package manager for the Node JavaScript platform. It puts
modules in place so that node can find them, and manages dependency
Expand Down
4 changes: 2 additions & 2 deletions deps/npm/lib/audit.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ const Arborist = require('@npmcli/arborist')
const auditReport = require('npm-audit-report')
const npm = require('./npm.js')
const output = require('./utils/output.js')
const reifyOutput = require('./utils/reify-output.js')
const reifyFinish = require('./utils/reify-finish.js')
const auditError = require('./utils/audit-error.js')

const audit = async args => {
Expand All @@ -14,7 +14,7 @@ const audit = async args => {
const fix = args[0] === 'fix'
await arb.audit({ fix })
if (fix)
reifyOutput(arb)
await reifyFinish(arb)
else {
// will throw if there's an error, because this is an audit command
auditError(arb.auditReport)
Expand Down
4 changes: 2 additions & 2 deletions deps/npm/lib/ci.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const util = require('util')
const Arborist = require('@npmcli/arborist')
const rimraf = util.promisify(require('rimraf'))
const reifyOutput = require('./utils/reify-output.js')
const reifyFinish = require('./utils/reify-finish.js')

const log = require('npmlog')
const npm = require('./npm.js')
Expand Down Expand Up @@ -35,7 +35,7 @@ const ci = async () => {
])
// npm ci should never modify the lockfile or package.json
await arb.reify({ ...npm.flatOptions, save: false })
reifyOutput(arb)
await reifyFinish(arb)
}

module.exports = Object.assign(cmd, { completion, usage })
4 changes: 2 additions & 2 deletions deps/npm/lib/dedupe.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
const npm = require('./npm.js')
const Arborist = require('@npmcli/arborist')
const usageUtil = require('./utils/usage.js')
const reifyOutput = require('./utils/reify-output.js')
const reifyFinish = require('./utils/reify-finish.js')

const usage = usageUtil('dedupe', 'npm dedupe')
const completion = require('./utils/completion/none.js')
Expand All @@ -18,7 +18,7 @@ const dedupe = async (args) => {
dryRun,
})
await arb.dedupe(npm.flatOptions)
reifyOutput(arb)
await reifyFinish(arb)
}

module.exports = Object.assign(cmd, { usage, completion })
15 changes: 8 additions & 7 deletions deps/npm/lib/init.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
// initialize a package.json file

const usageUtil = require('./utils/usage.js')
const completion = require('./utils/completion/none.js')
'use strict'

const initJson = require('init-package-json')
const npa = require('npm-package-arg')

const npm = require('./npm.js')
const initJson = require('init-package-json')
const usageUtil = require('./utils/usage.js')
const completion = require('./utils/completion/none.js')
const output = require('./utils/output.js')

const usage = usageUtil(
Expand Down Expand Up @@ -78,11 +78,12 @@ const init = async args => {
npm.log.warn('init', 'canceled')
return res()
}
npm.log.info('init', 'written successfully')
if (er)
rej(er)
else
else {
npm.log.info('init', 'written successfully')
res(data)
}
})
})
}
Expand Down
63 changes: 30 additions & 33 deletions deps/npm/lib/install.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,15 @@ const util = require('util')
const readdir = util.promisify(fs.readdir)
const npm = require('./npm.js')
const usageUtil = require('./utils/usage.js')
const reifyOutput = require('./utils/reify-output.js')
const reifyFinish = require('./utils/reify-finish.js')
const log = require('npmlog')
const { resolve, join } = require('path')
const Arborist = require('@npmcli/arborist')
const runScript = require('@npmcli/run-script')

const install = async (args, cb) => {
const cmd = async (args, cb) => install(args).then(() => cb()).catch(cb)

const install = async args => {
// the /path/to/node_modules/..
const globalTop = resolve(npm.globalDir, '..')
const { ignoreScripts, global: isGlobalInstall } = npm.flatOptions
Expand All @@ -34,38 +36,33 @@ const install = async (args, cb) => {
path: where,
})

try {
await arb.reify({
...npm.flatOptions,
add: args,
})
if (!args.length && !isGlobalInstall && !ignoreScripts) {
const { scriptShell } = npm.flatOptions
const scripts = [
'preinstall',
'install',
'postinstall',
'prepublish', // XXX should we remove this finally??
'preprepare',
'prepare',
'postprepare',
]
for (const event of scripts) {
await runScript({
path: where,
args: [],
scriptShell,
stdio: 'inherit',
stdioString: true,
event,
})
}
await arb.reify({
...npm.flatOptions,
add: args,
})
if (!args.length && !isGlobalInstall && !ignoreScripts) {
const { scriptShell } = npm.flatOptions
const scripts = [
'preinstall',
'install',
'postinstall',
'prepublish', // XXX should we remove this finally??
'preprepare',
'prepare',
'postprepare',
]
for (const event of scripts) {
await runScript({
path: where,
args: [],
scriptShell,
stdio: 'inherit',
stdioString: true,
event,
})
}
reifyOutput(arb)
cb()
} catch (er) {
cb(er)
}
await reifyFinish(arb)
}

const usage = usageUtil(
Expand Down Expand Up @@ -144,4 +141,4 @@ const completion = async (opts, cb) => {
cb()
}

module.exports = Object.assign(install, { usage, completion })
module.exports = Object.assign(cmd, { usage, completion })
6 changes: 3 additions & 3 deletions deps/npm/lib/link.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const semver = require('semver')

const npm = require('./npm.js')
const usageUtil = require('./utils/usage.js')
const reifyOutput = require('./utils/reify-output.js')
const reifyFinish = require('./utils/reify-finish.js')

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

reifyOutput(localArb)
await reifyFinish(localArb)
}

const linkPkg = async () => {
Expand All @@ -133,7 +133,7 @@ const linkPkg = async () => {
global: true,
})
await arb.reify({ add: [`file:${npm.prefix}`] })
reifyOutput(arb)
await reifyFinish(arb)
}

module.exports = Object.assign(cmd, { completion, usage })
4 changes: 2 additions & 2 deletions deps/npm/lib/prune.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ const npm = require('./npm.js')
const Arborist = require('@npmcli/arborist')
const usageUtil = require('./utils/usage.js')

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

const usage = usageUtil('prune',
'npm prune [[<@scope>/]<pkg>...] [--production]'
Expand All @@ -19,7 +19,7 @@ const prune = async () => {
path: where,
})
await arb.prune(npm.flatOptions)
reifyOutput(arb)
await reifyFinish(arb)
}

module.exports = Object.assign(cmd, { usage, completion })
2 changes: 1 addition & 1 deletion deps/npm/lib/run-script.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ const runScript = async (args) => {

pkg.scripts = scripts

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

Expand Down
4 changes: 2 additions & 2 deletions deps/npm/lib/uninstall.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const npm = require('./npm.js')
const rpj = require('read-package-json-fast')
const { resolve } = require('path')
const usageUtil = require('./utils/usage.js')
const reifyOutput = require('./utils/reify-output.js')
const reifyFinish = require('./utils/reify-finish.js')

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

Expand All @@ -32,7 +32,7 @@ const rm = async args => {
...npm.flatOptions,
rm: args,
})
reifyOutput(arb)
await reifyFinish(arb)
}

const usage = usageUtil(
Expand Down
4 changes: 2 additions & 2 deletions deps/npm/lib/update.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const Arborist = require('@npmcli/arborist')
const log = require('npmlog')
const npm = require('./npm.js')
const usageUtil = require('./utils/usage.js')
const reifyOutput = require('./utils/reify-output.js')
const reifyFinish = require('./utils/reify-finish.js')
const completion = require('./utils/completion/installed-deep.js')

const usage = usageUtil(
Expand Down Expand Up @@ -32,7 +32,7 @@ const update = async args => {
})

await arb.reify({ update })
reifyOutput(arb)
await reifyFinish(arb)
}

module.exports = Object.assign(cmd, { usage, completion })
31 changes: 31 additions & 0 deletions deps/npm/lib/utils/reify-finish.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
const reifyOutput = require('./reify-output.js')
const npm = require('../npm.js')
const ini = require('ini')
const {writeFile} = require('fs').promises
const {resolve} = require('path')

const reifyFinish = async arb => {
await saveBuiltinConfig(arb)
reifyOutput(arb)
}

const saveBuiltinConfig = async arb => {
const { options: { global }, actualTree } = arb
if (!global)
return

// if we are using a builtin config, and just installed npm as
// a top-level global package, we have to preserve that config.
const npmNode = actualTree.inventory.get('node_modules/npm')
if (!npmNode)
return

const builtinConf = npm.config.data.get('builtin')
if (builtinConf.loadError)
return

const content = ini.stringify(builtinConf.raw).trim() + '\n'
await writeFile(resolve(npmNode.path, 'npmrc'), content)
}

module.exports = reifyFinish
4 changes: 2 additions & 2 deletions deps/npm/man/man1/npm-audit.1
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
.P
.RS 2
.nf
npm audit [\-\-json|\-\-parseable|\-\-audit\-level=(low|moderate|high|critical)]
npm audit fix [\-\-force|\-\-package\-lock\-only|\-\-dry\-run]
npm audit [\-\-json] [\-\-production] [\-\-audit\-level=(low|moderate|high|critical)]
npm audit fix [\-\-force|\-\-package\-lock\-only|\-\-dry\-run|\-\-production|\-\-only=(dev|prod)]

common options: [\-\-production] [\-\-only=(dev|prod)]
.fi
Expand Down
Loading

0 comments on commit c23ee37

Please sign in to comment.