From d5e680a0c8ecf2fdbef0dcd073cc7e2dc88f6948 Mon Sep 17 00:00:00 2001 From: Guan Tong Date: Sun, 2 Aug 2026 21:15:58 +0800 Subject: [PATCH] fix: honor node-gyp config in dependency lifecycle scripts --- workspaces/arborist/lib/arborist/rebuild.js | 1 + workspaces/arborist/test/arborist/rebuild.js | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/workspaces/arborist/lib/arborist/rebuild.js b/workspaces/arborist/lib/arborist/rebuild.js index 53c6f63e77d94..d20870721e6c1 100644 --- a/workspaces/arborist/lib/arborist/rebuild.js +++ b/workspaces/arborist/lib/arborist/rebuild.js @@ -350,6 +350,7 @@ module.exports = cls => class Builder extends cls { pkg, stdio, env, + nodeGyp: this.options.nodeGyp, scriptShell: this.options.scriptShell, } const p = runScript(runOpts).catch(er => { diff --git a/workspaces/arborist/test/arborist/rebuild.js b/workspaces/arborist/test/arborist/rebuild.js index 6c3062be89a00..f418988adc9c1 100644 --- a/workspaces/arborist/test/arborist/rebuild.js +++ b/workspaces/arborist/test/arborist/rebuild.js @@ -553,7 +553,8 @@ t.test('rebuild node-gyp dependencies lacking both preinstall and install script }, }), }) - const arb = new Arborist({ path, dangerouslyAllowAllScripts: true }) + const nodeGyp = '/test/node-gyp.js' + const arb = new Arborist({ path, dangerouslyAllowAllScripts: true, nodeGyp }) await arb.rebuild() t.match(RUNS, [ { @@ -569,6 +570,7 @@ t.test('rebuild node-gyp dependencies lacking both preinstall and install script npm_package_peer: '', npm_package_dev_optional: '', }, + nodeGyp, scriptShell: undefined, }, ])