Skip to content

Commit

Permalink
fix: add back bin/node-gyp-bin/node-gyp files
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
lukekarrys committed Oct 25, 2023
1 parent e6cce28 commit 565b678
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 3 deletions.
6 changes: 6 additions & 0 deletions bin/node-gyp-bin/node-gyp
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/usr/bin/env sh
if [ "x$npm_config_node_gyp" = "x" ]; then
node "`dirname "$0"`/../../node_modules/node-gyp/bin/node-gyp.js" "$@"
else
"$npm_config_node_gyp" "$@"
fi
5 changes: 5 additions & 0 deletions bin/node-gyp-bin/node-gyp.cmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
if not defined npm_config_node_gyp (
node "%~dp0\..\..\node_modules\node-gyp\bin\node-gyp.js" %*
) else (
node "%npm_config_node_gyp%" %*
)
7 changes: 4 additions & 3 deletions test/bin/windows-shims.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const t = require('tap')
const { spawnSync } = require('child_process')
const { resolve, join, extname, basename, sep } = require('path')
const { readFileSync, chmodSync, readdirSync } = require('fs')
const { readFileSync, chmodSync, readdirSync, statSync } = require('fs')
const Diff = require('diff')
const { sync: which } = require('which')
const { version } = require('../../package.json')
Expand All @@ -10,8 +10,9 @@ const ROOT = resolve(__dirname, '../..')
const BIN = join(ROOT, 'bin')
const NODE = readFileSync(process.execPath)
const SHIMS = readdirSync(BIN).reduce((acc, shim) => {
if (extname(shim) !== '.js') {
acc[shim] = readFileSync(join(BIN, shim), 'utf-8')
const p = join(BIN, shim)
if (extname(p) !== '.js' && !statSync(p).isDirectory()) {
acc[shim] = readFileSync(p, 'utf-8')
}
return acc
}, {})
Expand Down

0 comments on commit 565b678

Please sign in to comment.