@npmcli/run-script
Advanced tools
Comparing version
/* eslint camelcase: "off" */ | ||
const setPATH = require('./set-path.js') | ||
const { resolve } = require('path') | ||
const npm_config_node_gyp = require.resolve('node-gyp/bin/node-gyp.js') | ||
let npm_config_node_gyp | ||
const makeSpawnArgs = options => { | ||
const { | ||
args, | ||
binPaths, | ||
cmd, | ||
env, | ||
event, | ||
nodeGyp, | ||
path, | ||
scriptShell = true, | ||
binPaths, | ||
env, | ||
stdio, | ||
cmd, | ||
args, | ||
stdioString, | ||
} = options | ||
if (nodeGyp) { | ||
// npm already pulled this from env and passes it in to options | ||
npm_config_node_gyp = nodeGyp | ||
} else if (env.npm_config_node_gyp) { | ||
// legacy mode for standalone user | ||
npm_config_node_gyp = env.npm_config_node_gyp | ||
} else { | ||
// default | ||
npm_config_node_gyp = require.resolve('node-gyp/bin/node-gyp.js') | ||
} | ||
const spawnEnv = setPATH(path, binPaths, { | ||
@@ -20,0 +33,0 @@ // we need to at least save the PATH environment var |
@@ -10,14 +10,15 @@ const makeSpawnArgs = require('./make-spawn-args.js') | ||
const { | ||
args = [], | ||
binPaths = false, | ||
env = {}, | ||
event, | ||
nodeGyp, | ||
path, | ||
pkg, | ||
scriptShell, | ||
binPaths = false, | ||
env = {}, | ||
stdio = 'pipe', | ||
pkg, | ||
args = [], | ||
stdioString, | ||
// how long to wait for a process.kill signal | ||
// only exposed here so that we can make the test go a bit faster. | ||
signalTimeout = 500, | ||
stdio = 'pipe', | ||
stdioString, | ||
} = options | ||
@@ -67,10 +68,11 @@ | ||
const [spawnShell, spawnArgs, spawnOpts] = makeSpawnArgs({ | ||
args, | ||
binPaths, | ||
cmd, | ||
env: { ...env, ...packageEnvs(pkg) }, | ||
event, | ||
nodeGyp, | ||
path, | ||
scriptShell, | ||
binPaths, | ||
env: { ...env, ...packageEnvs(pkg) }, | ||
stdio, | ||
cmd, | ||
args, | ||
stdioString, | ||
@@ -77,0 +79,0 @@ }) |
{ | ||
"name": "@npmcli/run-script", | ||
"version": "9.0.2", | ||
"version": "9.1.0", | ||
"description": "Run a lifecycle script for a package (descendant of npm-lifecycle)", | ||
@@ -19,3 +19,3 @@ "author": "GitHub Inc.", | ||
"@npmcli/eslint-config": "^5.0.0", | ||
"@npmcli/template-oss": "4.23.4", | ||
"@npmcli/template-oss": "4.24.1", | ||
"spawk": "^1.8.1", | ||
@@ -46,3 +46,3 @@ "tap": "^16.0.1" | ||
"//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.", | ||
"version": "4.23.4", | ||
"version": "4.24.1", | ||
"publish": "true" | ||
@@ -49,0 +49,0 @@ }, |
18606
1.87%318
4.26%