deps: upgrade npm to 8.14.0

PR-URL: https://github.com/nodejs/node/pull/43826
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Mohammed Keyvanzadeh <mohammadkeyvanzade94@gmail.com>
Reviewed-By: Darshan Sen <raisinten@gmail.com>
This commit is contained in:
npm CLI robot 2022-07-19 08:51:49 -07:00 committed by GitHub
parent 8657d6db07
commit dd167ff0ee
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
133 changed files with 3788 additions and 512 deletions

View file

@ -1,12 +1,19 @@
/* eslint camelcase: "off" */
const isWindows = require('./is-windows.js')
const setPATH = require('./set-path.js')
const { chmodSync: chmod, unlinkSync: unlink, writeFileSync: writeFile } = require('fs')
const { unlinkSync: unlink, writeFileSync: writeFile } = require('fs')
const { tmpdir } = require('os')
const { isAbsolute, resolve } = require('path')
const { resolve } = require('path')
const which = require('which')
const npm_config_node_gyp = require.resolve('node-gyp/bin/node-gyp.js')
const escape = require('./escape.js')
const { randomBytes } = require('crypto')
const translateWinPathToPosix = (path) => {
return path
.replace(/^([A-z]):/, '/$1')
.replace(/\\/g, '/')
}
const makeSpawnArgs = options => {
const {
@ -30,7 +37,7 @@ const makeSpawnArgs = options => {
npm_config_node_gyp,
})
const fileName = escape.filename(`${event}-${Date.now()}`)
const fileName = escape.filename(`${event}-${randomBytes(4).toString('hex')}`)
let scriptFile
let script = ''
@ -69,24 +76,17 @@ const makeSpawnArgs = options => {
script += ` ${args.map((arg) => escape.cmd(arg, doubleEscape)).join(' ')}`
}
} else {
const shebang = isAbsolute(scriptShell)
? `#!${scriptShell}`
: `#!/usr/bin/env ${scriptShell}`
scriptFile = resolve(tmpdir(), `${fileName}.sh`)
script += `${shebang}\n`
script += cmd
script = cmd
if (args.length) {
script += ` ${args.map((arg) => escape.sh(arg)).join(' ')}`
}
}
writeFile(scriptFile, script)
if (!isCmd) {
chmod(scriptFile, '0775')
}
const spawnArgs = isCmd
? ['/d', '/s', '/c', escape.cmd(scriptFile)]
: ['-c', escape.sh(scriptFile)]
: [isWindows ? translateWinPathToPosix(scriptFile) : scriptFile]
const spawnOpts = {
env: spawnEnv,