Skip to content

Commit c93edb5

Browse files
committed
fix: add back bin/node-gyp-bin/node-gyp files
This was an unintended breaking change as part of #6554. The `node-gyp` bin files are not used by the CLI directly but they are relied on by other tooling. This change is only intended to land on the v9 release line. This partially reverts commit 3a7378d.
1 parent 1275cae commit c93edb5

File tree

3 files changed

+15
-3
lines changed

3 files changed

+15
-3
lines changed

bin/node-gyp-bin/node-gyp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#!/usr/bin/env sh
2+
if [ "x$npm_config_node_gyp" = "x" ]; then
3+
node "`dirname "$0"`/../../node_modules/node-gyp/bin/node-gyp.js" "$@"
4+
else
5+
"$npm_config_node_gyp" "$@"
6+
fi

bin/node-gyp-bin/node-gyp.cmd

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
if not defined npm_config_node_gyp (
2+
node "%~dp0\..\..\node_modules\node-gyp\bin\node-gyp.js" %*
3+
) else (
4+
node "%npm_config_node_gyp%" %*
5+
)

test/bin/windows-shims.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
const t = require('tap')
22
const { spawnSync } = require('child_process')
33
const { resolve, join, extname, basename, sep } = require('path')
4-
const { readFileSync, chmodSync, readdirSync } = require('fs')
4+
const { readFileSync, chmodSync, readdirSync, statSync } = require('fs')
55
const Diff = require('diff')
66
const { sync: which } = require('which')
77
const { version } = require('../../package.json')
@@ -10,8 +10,9 @@ const ROOT = resolve(__dirname, '../..')
1010
const BIN = join(ROOT, 'bin')
1111
const NODE = readFileSync(process.execPath)
1212
const SHIMS = readdirSync(BIN).reduce((acc, shim) => {
13-
if (extname(shim) !== '.js') {
14-
acc[shim] = readFileSync(join(BIN, shim), 'utf-8')
13+
const p = join(BIN, shim)
14+
if (extname(p) !== '.js' && !statSync(p).isDirectory()) {
15+
acc[shim] = readFileSync(p, 'utf-8')
1516
}
1617
return acc
1718
}, {})

0 commit comments

Comments
 (0)