Skip to content

Commit 6d49207

Browse files
MylesBorinsisaacs
authored andcommitted
Revert "Remove unused npx binary"
This reverts commit f019a24. Git Bash on Windows still uses this file. Removing it broke the windows MSI builds in Node.js infrastructure. Unless we absolutely need to remove this I think it is worth keeping around PR-URL: #1903 Credit: @MylesBorins Close: #1903 Reviewed-by: @isaacs
1 parent f34595f commit 6d49207

1 file changed

Lines changed: 39 additions & 0 deletions

File tree

bin/npx

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
#!/bin/sh
2+
3+
# This is used by the Node.js installer, which expects the cygwin/mingw
4+
# shell script to already be present in the npm dependency folder.
5+
6+
(set -o igncr) 2>/dev/null && set -o igncr; # cygwin encoding fix
7+
8+
basedir=`dirname "$0"`
9+
10+
case `uname` in
11+
*CYGWIN*) basedir=`cygpath -w "$basedir"`;;
12+
esac
13+
14+
NODE_EXE="$basedir/node.exe"
15+
if ! [ -x "$NODE_EXE" ]; then
16+
NODE_EXE=node
17+
fi
18+
19+
NPM_CLI_JS="$basedir/node_modules/npm/bin/npm-cli.js"
20+
NPX_CLI_JS="$basedir/node_modules/npm/bin/npx-cli.js"
21+
22+
case `uname` in
23+
*MINGW*)
24+
NPM_PREFIX=`"$NODE_EXE" "$NPM_CLI_JS" prefix -g`
25+
NPM_PREFIX_NPX_CLI_JS="$NPM_PREFIX/node_modules/npm/bin/npx-cli.js"
26+
if [ -f "$NPM_PREFIX_NPX_CLI_JS" ]; then
27+
NPX_CLI_JS="$NPM_PREFIX_NPX_CLI_JS"
28+
fi
29+
;;
30+
*CYGWIN*)
31+
NPM_PREFIX=`"$NODE_EXE" "$NPM_CLI_JS" prefix -g`
32+
NPM_PREFIX_NPX_CLI_JS="$NPM_PREFIX/node_modules/npm/bin/npx-cli.js"
33+
if [ -f "$NPM_PREFIX_NPX_CLI_JS" ]; then
34+
NPX_CLI_JS="$NPM_PREFIX_NPX_CLI_JS"
35+
fi
36+
;;
37+
esac
38+
39+
"$NODE_EXE" "$NPX_CLI_JS" "$@"

0 commit comments

Comments
 (0)