Skip to content

Commit

Permalink
Try $script_dir path on Linux
Browse files Browse the repository at this point in the history
  • Loading branch information
karlhorky committed Oct 26, 2024
1 parent c577430 commit b94ce58
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions bin/preflight.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,13 @@ script_dir="$(cd "$(dirname "$0")" && pwd)"
# Workaround for incorrect path in pnpm shim
# https://github.com/pnpm/pnpm/issues/8704#issuecomment-2439618363
#
# TODO: Remove and switch back to "$script_dir/../node_modules/bin"
# TODO: Remove and switch back to "$script_dir/../node_modules/.bin/tsx"
# when the issue above is resolved
tsx_shim="$script_dir/../node_modules/.bin/tsx"
exec_command=$(awk '/^else$/{flag=1;next}/^fi$/{flag=0}flag' "$tsx_shim" | grep 'exec node')
cli_path=$(echo "$exec_command" | sed -E 's/^[[:space:]]*exec node[[:space:]]+"([^"]+)".*/\1/')
cli_path="${cli_path/\$basedir/$script_dir}"
cli_path="${cli_path/\/pnpm\//\/pnpm\/global\/5\/.pnpm\/}"

node "$cli_path" "$script_dir/../src/index.ts"
# node "$cli_path" "$script_dir/../src/index.ts"
node "$script_dir/../node_modules/.bin/tsx" "$script_dir/../src/index.ts"

0 comments on commit b94ce58

Please sign in to comment.