Skip to content

Commit

Permalink
deps: @npmcli/run-script@4.2.0
Browse files Browse the repository at this point in the history
  - add `binPaths` param
  • Loading branch information
wraithgar authored and nlf committed Aug 2, 2022
1 parent cd6bafd commit d0be9a2
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 16 deletions.
7 changes: 5 additions & 2 deletions node_modules/@npmcli/run-script/lib/make-spawn-args.js
Expand Up @@ -20,14 +20,15 @@ const makeSpawnArgs = options => {
event,
path,
scriptShell = isWindows ? process.env.ComSpec || 'cmd' : 'sh',
binPaths,
env = {},
stdio,
cmd,
args = [],
stdioString = false,
} = options

const spawnEnv = setPATH(path, {
const spawnEnv = setPATH(path, binPaths, {
// we need to at least save the PATH environment var
...process.env,
...env,
Expand Down Expand Up @@ -100,7 +101,9 @@ const makeSpawnArgs = options => {
// delete the script, this is just a best effort
try {
unlink(scriptFile)
} catch (err) {}
} catch (err) {
// ignore errors
}
}

return [scriptShell, spawnArgs, spawnOpts, cleanup]
Expand Down
2 changes: 2 additions & 0 deletions node_modules/@npmcli/run-script/lib/run-script-pkg.js
Expand Up @@ -14,6 +14,7 @@ const runScriptPkg = async options => {
event,
path,
scriptShell,
binPaths = false,
env = {},
stdio = 'pipe',
pkg,
Expand Down Expand Up @@ -58,6 +59,7 @@ const runScriptPkg = async options => {
event,
path,
scriptShell,
binPaths,
env: packageEnvs(env, pkg),
stdio,
cmd,
Expand Down
12 changes: 6 additions & 6 deletions node_modules/@npmcli/run-script/lib/set-path.js
@@ -1,24 +1,24 @@
const { resolve, dirname } = require('path')
const isWindows = require('./is-windows.js')
const { resolve, dirname, delimiter } = require('path')
// the path here is relative, even though it does not need to be
// in order to make the posix tests pass in windows
const nodeGypPath = resolve(__dirname, '../lib/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 setPATH = (projectPath, binPaths, env) => {
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(concatted => !set.includes(concatted))), [])
.join(delimiter)

const pathArr = []
if (binPaths) {
pathArr.push(...binPaths)
}
// 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?
// XXX we should specify a cwd that we don't go above
let p = projectPath
let pp
do {
Expand Down
2 changes: 1 addition & 1 deletion node_modules/@npmcli/run-script/package.json
@@ -1,6 +1,6 @@
{
"name": "@npmcli/run-script",
"version": "4.1.7",
"version": "4.2.0",
"description": "Run a lifecycle script for a package (descendant of npm-lifecycle)",
"author": "GitHub Inc.",
"license": "ISC",
Expand Down
10 changes: 5 additions & 5 deletions package-lock.json
Expand Up @@ -94,7 +94,7 @@
"@npmcli/fs": "^2.1.0",
"@npmcli/map-workspaces": "^2.0.3",
"@npmcli/package-json": "^2.0.0",
"@npmcli/run-script": "^4.1.7",
"@npmcli/run-script": "^4.2.0",
"abbrev": "~1.1.1",
"archy": "~1.0.0",
"cacache": "^16.1.1",
Expand Down Expand Up @@ -1057,9 +1057,9 @@
}
},
"node_modules/@npmcli/run-script": {
"version": "4.1.7",
"resolved": "https://registry.npmjs.org/@npmcli/run-script/-/run-script-4.1.7.tgz",
"integrity": "sha512-WXr/MyM4tpKA4BotB81NccGAv8B48lNH0gRoILucbcAhTQXLCoi6HflMV3KdXubIqvP9SuLsFn68Z7r4jl+ppw==",
"version": "4.2.0",
"resolved": "https://registry.npmjs.org/@npmcli/run-script/-/run-script-4.2.0.tgz",
"integrity": "sha512-e/QgLg7j2wSJp1/7JRl0GC8c7PMX+uYlA/1Tb+IDOLdSM4T7K1VQ9mm9IGU3WRtY5vEIObpqCLb3aCNCug18DA==",
"inBundle": true,
"dependencies": {
"@npmcli/node-gyp": "^2.0.0",
Expand Down Expand Up @@ -10137,7 +10137,7 @@
"@npmcli/arborist": "^5.0.0",
"@npmcli/ci-detect": "^2.0.0",
"@npmcli/fs": "^2.1.1",
"@npmcli/run-script": "^4.1.3",
"@npmcli/run-script": "^4.2.0",
"chalk": "^4.1.0",
"mkdirp-infer-owner": "^2.0.0",
"npm-package-arg": "^9.0.1",
Expand Down
2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -62,7 +62,7 @@
"@npmcli/fs": "^2.1.0",
"@npmcli/map-workspaces": "^2.0.3",
"@npmcli/package-json": "^2.0.0",
"@npmcli/run-script": "^4.1.7",
"@npmcli/run-script": "^4.2.0",
"abbrev": "~1.1.1",
"archy": "~1.0.0",
"cacache": "^16.1.1",
Expand Down
2 changes: 1 addition & 1 deletion workspaces/libnpmexec/package.json
Expand Up @@ -58,7 +58,7 @@
"@npmcli/arborist": "^5.0.0",
"@npmcli/ci-detect": "^2.0.0",
"@npmcli/fs": "^2.1.1",
"@npmcli/run-script": "^4.1.3",
"@npmcli/run-script": "^4.2.0",
"chalk": "^4.1.0",
"mkdirp-infer-owner": "^2.0.0",
"npm-package-arg": "^9.0.1",
Expand Down

0 comments on commit d0be9a2

Please sign in to comment.