mirror of
https://github.com/nodejs/node.git
synced 2025-08-20 01:15:51 +02:00
deps: update npm to 7.0.0-rc.3
PR-URL: https://github.com/nodejs/node/pull/35474 Reviewed-By: Ruy Adorno <ruyadorno@github.com> Reviewed-By: Ujjwal Sharma <ryzokuken@disroot.org> Reviewed-By: Ben Coe <bencoe@gmail.com> Reviewed-By: Geoffrey Booth <webmaster@geoffreybooth.com> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Shelley Vohr <codebytere@gmail.com> Reviewed-By: Guy Bedford <guybedford@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
This commit is contained in:
parent
1469984645
commit
2e54524955
4238 changed files with 192906 additions and 296892 deletions
42
deps/npm/node_modules/@npmcli/run-script/lib/set-path.js
generated
vendored
Normal file
42
deps/npm/node_modules/@npmcli/run-script/lib/set-path.js
generated
vendored
Normal file
|
@ -0,0 +1,42 @@
|
|||
const {resolve, dirname} = require('path')
|
||||
const isWindows = require('./is-windows.js')
|
||||
const nodeGypPath = resolve(__dirname, 'node-gyp-bin')
|
||||
|
||||
// Windows typically calls its PATH environ 'Path', but this is not
|
||||
// guaranteed, nor is it guaranteed to be the only one. Merge them
|
||||
// all together in the order they appear in the object.
|
||||
const setPATH = (projectPath, env) => {
|
||||
// not require('path').delimiter, because we fake this for testing
|
||||
const delimiter = isWindows ? ';' : ':'
|
||||
const PATH = Object.keys(env).filter(p => /^path$/i.test(p) && env[p])
|
||||
.map(p => env[p].split(delimiter))
|
||||
.reduce((set, p) => set.concat(p.filter(p => !set.includes(p))), [])
|
||||
.join(delimiter)
|
||||
|
||||
const pathArr = []
|
||||
// unshift the ./node_modules/.bin from every folder
|
||||
// walk up until dirname() does nothing, at the root
|
||||
// XXX should we specify a cwd that we don't go above?
|
||||
let p = projectPath
|
||||
let pp
|
||||
do {
|
||||
pathArr.push(resolve(p, 'node_modules', '.bin'))
|
||||
pp = p
|
||||
p = dirname(p)
|
||||
} while (p !== pp)
|
||||
pathArr.push(nodeGypPath, PATH)
|
||||
|
||||
const pathVal = pathArr.join(delimiter)
|
||||
|
||||
// XXX include the node-gyp-bin path somehow? Probably better for
|
||||
// npm or arborist or whoever to just provide that by putting it in
|
||||
// the PATH environ, since that's preserved anyway.
|
||||
for (const key of Object.keys(env)) {
|
||||
if (/^path$/i.test(key))
|
||||
env[key] = pathVal
|
||||
}
|
||||
|
||||
return env
|
||||
}
|
||||
|
||||
module.exports = setPATH
|
Loading…
Add table
Add a link
Reference in a new issue