Content-Length: 296722 | pFad | http://github.com/npm/run-script/pull/230/commits/1017d3bbc688a151b53cc9026e50a63a5b529a57

8C feat: use nodeGyp option by wraithgar · Pull Request #230 · npm/run-script · GitHub
Skip to content

feat: use nodeGyp option #230

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Mar 7, 2025
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fixup: allow for nodeGyp to be passed as an option
  • Loading branch information
wraithgar committed Mar 5, 2025
commit 1017d3bbc688a151b53cc9026e50a63a5b529a57
15 changes: 13 additions & 2 deletions lib/make-spawn-args.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
/* 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')

const makeSpawnArgs = options => {
const {
Expand All @@ -14,16 +13,28 @@ const makeSpawnArgs = options => {
cmd,
args,
stdioString,
nodeGyp,
} = 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')
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Even if we built a safeguard in here in case require.resolve wasn't available we'd still need this to throw if this default was needed and failed, so it's effectively a NOP. If you need this code to work in an environment that doesn't have require.resolve you can pass in the option or set the environment variable.

}

const spawnEnv = setPATH(path, binPaths, {
// we need to at least save the PATH environment var
...process.env,
npm_package_json: resolve(path, 'package.json'),
npm_lifecycle_event: event,
npm_lifecycle_script: cmd,
npm_config_node_gyp,
...env,
npm_config_node_gyp,
})

const spawnOpts = {
Expand Down








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/npm/run-script/pull/230/commits/1017d3bbc688a151b53cc9026e50a63a5b529a57

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy