Skip to content
Merged
Show file tree
Hide file tree
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
feat: update shell scripts to match npm
  • Loading branch information
500-internal-server-error committed Apr 18, 2025
commit b8c07a2b3a04b1e4dadda2272d1d53f4fd1f0cda
12 changes: 10 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -438,7 +438,11 @@ function generateShShim (src: string, to: string, opts: InternalOptions): string
// basedir=`dirname "$0"`
//
// case `uname` in
// *CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;;
// *CYGWIN*|*MINGW*|*MSYS*)
// if command -v cygpath > /dev/null 2>&1; then
// basedir=`cygpath -w "$basedir"`;;
// fi
// ;;
// esac
//
// export NODE_PATH="<nodepath>"
Expand All @@ -454,7 +458,11 @@ function generateShShim (src: string, to: string, opts: InternalOptions): string
basedir=$(dirname "$(echo "$0" | sed -e 's,\\\\,/,g')")

case \`uname\` in
*CYGWIN*|*MINGW*|*MSYS*) basedir=\`cygpath -w "$basedir"\`;;
*CYGWIN*|*MINGW*|*MSYS*)
if command -v cygpath > /dev/null 2>&1; then
basedir=\`cygpath -w "$basedir"\`;;
fi
;;
esac

`
Expand Down
6 changes: 5 additions & 1 deletion test/__snapshots__/e2e.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,11 @@ exports[`create a command shim for a .exe file 1`] = `
basedir=$(dirname "$(echo "$0" | sed -e 's,\\\\,/,g')")

case \`uname\` in
*CYGWIN*|*MINGW*|*MSYS*) basedir=\`cygpath -w "$basedir"\`;;
*CYGWIN*|*MINGW*|*MSYS*)
if command -v cygpath > /dev/null 2>&1; then
basedir=\`cygpath -w "$basedir"\`;;
fi
;;
esac

"$basedir/foo" "$@"
Expand Down
84 changes: 70 additions & 14 deletions test/__snapshots__/test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,11 @@ exports[`custom node executable env.shim 1`] = `
basedir=$(dirname "$(echo "$0" | sed -e 's,\\\\,/,g')")

case \`uname\` in
*CYGWIN*|*MINGW*|*MSYS*) basedir=\`cygpath -w "$basedir"\`;;
*CYGWIN*|*MINGW*|*MSYS*)
if command -v cygpath > /dev/null 2>&1; then
basedir=\`cygpath -w "$basedir"\`;;
fi
;;
esac

"/.pnpm/nodejs/16.0.0/node" "$basedir/src.env" "$@"
Expand Down Expand Up @@ -44,7 +48,11 @@ exports[`env shebang env.shim 1`] = `
basedir=$(dirname "$(echo "$0" | sed -e 's,\\\\,/,g')")

case \`uname\` in
*CYGWIN*|*MINGW*|*MSYS*) basedir=\`cygpath -w "$basedir"\`;;
*CYGWIN*|*MINGW*|*MSYS*)
if command -v cygpath > /dev/null 2>&1; then
basedir=\`cygpath -w "$basedir"\`;;
fi
;;
esac

if [ -x "$basedir/node" ]; then
Expand Down Expand Up @@ -103,7 +111,11 @@ exports[`env shebang with NODE_PATH env.shim 1`] = `
basedir=$(dirname "$(echo "$0" | sed -e 's,\\\\,/,g')")

case \`uname\` in
*CYGWIN*|*MINGW*|*MSYS*) basedir=\`cygpath -w "$basedir"\`;;
*CYGWIN*|*MINGW*|*MSYS*)
if command -v cygpath > /dev/null 2>&1; then
basedir=\`cygpath -w "$basedir"\`;;
fi
;;
esac

if [ -z "$NODE_PATH" ]; then
Expand Down Expand Up @@ -185,7 +197,11 @@ exports[`env shebang with PATH extending env.shim 1`] = `
basedir=$(dirname "$(echo "$0" | sed -e 's,\\\\,/,g')")

case \`uname\` in
*CYGWIN*|*MINGW*|*MSYS*) basedir=\`cygpath -w "$basedir"\`;;
*CYGWIN*|*MINGW*|*MSYS*)
if command -v cygpath > /dev/null 2>&1; then
basedir=\`cygpath -w "$basedir"\`;;
fi
;;
esac

export PATH="/add-to-path:$PATH"
Expand Down Expand Up @@ -256,7 +272,11 @@ exports[`env shebang with args env.args.shim 1`] = `
basedir=$(dirname "$(echo "$0" | sed -e 's,\\\\,/,g')")

case \`uname\` in
*CYGWIN*|*MINGW*|*MSYS*) basedir=\`cygpath -w "$basedir"\`;;
*CYGWIN*|*MINGW*|*MSYS*)
if command -v cygpath > /dev/null 2>&1; then
basedir=\`cygpath -w "$basedir"\`;;
fi
;;
esac

if [ -x "$basedir/node" ]; then
Expand Down Expand Up @@ -315,7 +335,11 @@ exports[`env shebang with default args env.shim 1`] = `
basedir=$(dirname "$(echo "$0" | sed -e 's,\\\\,/,g')")

case \`uname\` in
*CYGWIN*|*MINGW*|*MSYS*) basedir=\`cygpath -w "$basedir"\`;;
*CYGWIN*|*MINGW*|*MSYS*)
if command -v cygpath > /dev/null 2>&1; then
basedir=\`cygpath -w "$basedir"\`;;
fi
;;
esac

if [ -x "$basedir/node" ]; then
Expand Down Expand Up @@ -374,7 +398,11 @@ exports[`env shebang with no NODE_PATH env.shim 1`] = `
basedir=$(dirname "$(echo "$0" | sed -e 's,\\\\,/,g')")

case \`uname\` in
*CYGWIN*|*MINGW*|*MSYS*) basedir=\`cygpath -w "$basedir"\`;;
*CYGWIN*|*MINGW*|*MSYS*)
if command -v cygpath > /dev/null 2>&1; then
basedir=\`cygpath -w "$basedir"\`;;
fi
;;
esac

if [ -x "$basedir/node" ]; then
Expand Down Expand Up @@ -433,7 +461,11 @@ exports[`explicit shebang sh.shim 1`] = `
basedir=$(dirname "$(echo "$0" | sed -e 's,\\\\,/,g')")

case \`uname\` in
*CYGWIN*|*MINGW*|*MSYS*) basedir=\`cygpath -w "$basedir"\`;;
*CYGWIN*|*MINGW*|*MSYS*)
if command -v cygpath > /dev/null 2>&1; then
basedir=\`cygpath -w "$basedir"\`;;
fi
;;
esac

if [ -x "$basedir//usr/bin/sh" ]; then
Expand Down Expand Up @@ -492,7 +524,11 @@ exports[`explicit shebang with args sh.args.shim 1`] = `
basedir=$(dirname "$(echo "$0" | sed -e 's,\\\\,/,g')")

case \`uname\` in
*CYGWIN*|*MINGW*|*MSYS*) basedir=\`cygpath -w "$basedir"\`;;
*CYGWIN*|*MINGW*|*MSYS*)
if command -v cygpath > /dev/null 2>&1; then
basedir=\`cygpath -w "$basedir"\`;;
fi
;;
esac

if [ -x "$basedir//usr/bin/sh" ]; then
Expand Down Expand Up @@ -551,7 +587,11 @@ exports[`explicit shebang with args, linking to another drive on Windows sh.args
basedir=$(dirname "$(echo "$0" | sed -e 's,\\\\,/,g')")

case \`uname\` in
*CYGWIN*|*MINGW*|*MSYS*) basedir=\`cygpath -w "$basedir"\`;;
*CYGWIN*|*MINGW*|*MSYS*)
if command -v cygpath > /dev/null 2>&1; then
basedir=\`cygpath -w "$basedir"\`;;
fi
;;
esac

if [ -x "$basedir//usr/bin/sh" ]; then
Expand Down Expand Up @@ -610,7 +650,11 @@ exports[`explicit shebang with prog args sh.args.shim 1`] = `
basedir=$(dirname "$(echo "$0" | sed -e 's,\\\\,/,g')")

case \`uname\` in
*CYGWIN*|*MINGW*|*MSYS*) basedir=\`cygpath -w "$basedir"\`;;
*CYGWIN*|*MINGW*|*MSYS*)
if command -v cygpath > /dev/null 2>&1; then
basedir=\`cygpath -w "$basedir"\`;;
fi
;;
esac

if [ -x "$basedir//usr/bin/sh" ]; then
Expand Down Expand Up @@ -669,7 +713,11 @@ exports[`no cmd file exe.shim 1`] = `
basedir=$(dirname "$(echo "$0" | sed -e 's,\\\\,/,g')")

case \`uname\` in
*CYGWIN*|*MINGW*|*MSYS*) basedir=\`cygpath -w "$basedir"\`;;
*CYGWIN*|*MINGW*|*MSYS*)
if command -v cygpath > /dev/null 2>&1; then
basedir=\`cygpath -w "$basedir"\`;;
fi
;;
esac

"$basedir/src.exe" "$@"
Expand Down Expand Up @@ -702,7 +750,11 @@ exports[`no shebang exe.shim 1`] = `
basedir=$(dirname "$(echo "$0" | sed -e 's,\\\\,/,g')")

case \`uname\` in
*CYGWIN*|*MINGW*|*MSYS*) basedir=\`cygpath -w "$basedir"\`;;
*CYGWIN*|*MINGW*|*MSYS*)
if command -v cygpath > /dev/null 2>&1; then
basedir=\`cygpath -w "$basedir"\`;;
fi
;;
esac

"$basedir/src.exe" "$@"
Expand Down Expand Up @@ -741,7 +793,11 @@ exports[`shebang with -S from.env.S.shim 1`] = `
basedir=$(dirname "$(echo "$0" | sed -e 's,\\\\,/,g')")

case \`uname\` in
*CYGWIN*|*MINGW*|*MSYS*) basedir=\`cygpath -w "$basedir"\`;;
*CYGWIN*|*MINGW*|*MSYS*)
if command -v cygpath > /dev/null 2>&1; then
basedir=\`cygpath -w "$basedir"\`;;
fi
;;
esac

if [ -x "$basedir/node" ]; then
Expand Down