Skip to content

Commit

Permalink
fix(wip): pnpm
Browse files Browse the repository at this point in the history
  • Loading branch information
johnlindquist committed Sep 1, 2024
1 parent 1bb8052 commit 2ec2b8e
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 3 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -126,11 +126,14 @@ jobs:
- name: Log ./.kit
run: |
ls ./.kit/*/*
ls ./.kit/node_modules/.bin/*
- name: pnpm i
run: |
cd "${{ env.wd_path }}"
pnpm i
ls ./.kit/node_modules/.bin/*
- name: pnpm run ava
run: |
Expand Down
2 changes: 1 addition & 1 deletion root/bin/kit
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ KIT=$(cd "$(dirname $(readlink -f ${BASH_SOURCE[0]}))/.." &>/dev/null && pwd)
pwd
)"

KIT_NODE="${KIT_NODE:=$($KIT/node_modules/.bin/pnpm node -e 'console.log(process.execPath)')}"
KIT_NODE="${KIT_NODE:=$(command -v pnpm >/dev/null 2>&1 && $KIT/node_modules/.bin/pnpm node -e 'console.log(process.execPath)' || which node)}"
# Default to system node if KIT_NODE doesn't exist
[ ! -f "$KIT_NODE" ] && KIT_NODE=$(which node)

Expand Down
11 changes: 9 additions & 2 deletions root/bin/kit.bat
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,15 @@ if %errorlevel%==0 (

REM Set the default KIT_NODE variable to the custom node binary
if not defined KIT_NODE (
for /f "tokens=* USEBACKQ" %%F in (`powershell -Command "node_modules\.bin\pnpm node -e 'console.log(process.execPath)'"`) do (
set "KIT_NODE=%%F"
if exist "node_modules\.bin\pnpm" (
for /f "tokens=* USEBACKQ" %%F in (`powershell -Command "node_modules\.bin\pnpm node -e 'console.log(process.execPath)'"`) do (
set "KIT_NODE=%%F"
)
) else (
REM If pnpm doesn't exist, use the system's node binary
for /f "tokens=* USEBACKQ" %%F in (`where node`) do (
set "KIT_NODE=%%F"
)
)
)

Expand Down
7 changes: 7 additions & 0 deletions root/script
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,13 @@

KIT=$(cd "$(dirname ${BASH_SOURCE[0]})" &> /dev/null && pwd)
KIT_NODE="${KIT_NODE:=$KIT/node_modules/.bin/pnpm node}"
if ! command -v "$KIT_NODE" &> /dev/null; then
KIT_NODE=$(which node)
if [ -z "$KIT_NODE" ]; then
echo "Error: Node.js not found in PATH" >&2
exit 1
fi
fi

NODE_NO_WARNINGS=1 \
"$KIT_NODE" \
Expand Down

0 comments on commit 2ec2b8e

Please sign in to comment.