diff options
author | Gar <gar+gh@danger.computer> | 2022-08-01 20:12:34 +0300 |
---|---|---|
committer | nlf <nlf@github.com> | 2022-08-03 00:57:32 +0300 |
commit | d0be9a2bb53e74b30e13751afd1f6924990c8422 (patch) | |
tree | 27fc27771766aa89c0fbc3d786b42a9f64ebbf59 /node_modules | |
parent | cd6bafdfbbd7a054709c11850b58f7dbc26eb8da (diff) |
deps: @npmcli/run-script@4.2.0
- add `binPaths` param
Diffstat (limited to 'node_modules')
4 files changed, 14 insertions, 9 deletions
diff --git a/node_modules/@npmcli/run-script/lib/make-spawn-args.js b/node_modules/@npmcli/run-script/lib/make-spawn-args.js index f2253d7cc..7725fd976 100644 --- a/node_modules/@npmcli/run-script/lib/make-spawn-args.js +++ b/node_modules/@npmcli/run-script/lib/make-spawn-args.js @@ -20,6 +20,7 @@ const makeSpawnArgs = options => { event, path, scriptShell = isWindows ? process.env.ComSpec || 'cmd' : 'sh', + binPaths, env = {}, stdio, cmd, @@ -27,7 +28,7 @@ const makeSpawnArgs = options => { 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, @@ -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] diff --git a/node_modules/@npmcli/run-script/lib/run-script-pkg.js b/node_modules/@npmcli/run-script/lib/run-script-pkg.js index 84c5e2bfe..ec6ef31e5 100644 --- a/node_modules/@npmcli/run-script/lib/run-script-pkg.js +++ b/node_modules/@npmcli/run-script/lib/run-script-pkg.js @@ -14,6 +14,7 @@ const runScriptPkg = async options => { event, path, scriptShell, + binPaths = false, env = {}, stdio = 'pipe', pkg, @@ -58,6 +59,7 @@ const runScriptPkg = async options => { event, path, scriptShell, + binPaths, env: packageEnvs(env, pkg), stdio, cmd, diff --git a/node_modules/@npmcli/run-script/lib/set-path.js b/node_modules/@npmcli/run-script/lib/set-path.js index 07671f445..c59c270d9 100644 --- a/node_modules/@npmcli/run-script/lib/set-path.js +++ b/node_modules/@npmcli/run-script/lib/set-path.js @@ -1,5 +1,4 @@ -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') @@ -7,18 +6,19 @@ 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 { diff --git a/node_modules/@npmcli/run-script/package.json b/node_modules/@npmcli/run-script/package.json index c096f3942..a6629826d 100644 --- a/node_modules/@npmcli/run-script/package.json +++ b/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", |