Skip to content

Commit 81e0a77

Browse files
committed
consolidate sfw wrapper logic
1 parent aeb7fbf commit 81e0a77

3 files changed

Lines changed: 19 additions & 26 deletions

File tree

.github/workflows/integration_tests.yml

Lines changed: 3 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -124,31 +124,10 @@ jobs:
124124
with:
125125
mode: firewall-free
126126

127-
- name: Create sfw wrapper scripts for npm and bun
127+
- name: Activate sfw shims for npm and bun
128128
run: |
129-
mkdir -p "$RUNNER_TEMP/sfw-wrappers"
130-
cat > "$RUNNER_TEMP/sfw-wrappers/npm" <<'SHIM'
131-
#!/usr/bin/env bash
132-
SHIM_DIR="$(cd "$(dirname "$0")" && pwd)"
133-
export PATH="${PATH//$SHIM_DIR:/}"
134-
export PATH="${PATH//:$SHIM_DIR/}"
135-
case "${1-}" in
136-
install|ci|update|audit|pack|publish|fund|outdated) exec sfw npm "$@" ;;
137-
*) exec npm "$@" ;;
138-
esac
139-
SHIM
140-
cat > "$RUNNER_TEMP/sfw-wrappers/bun" <<'SHIM'
141-
#!/usr/bin/env bash
142-
SHIM_DIR="$(cd "$(dirname "$0")" && pwd)"
143-
export PATH="${PATH//$SHIM_DIR:/}"
144-
export PATH="${PATH//:$SHIM_DIR/}"
145-
case "${1-}" in
146-
install|add|update|pm) exec sfw bun "$@" ;;
147-
*) exec bun "$@" ;;
148-
esac
149-
SHIM
150-
chmod +x "$RUNNER_TEMP/sfw-wrappers/npm" "$RUNNER_TEMP/sfw-wrappers/bun"
151-
echo "$RUNNER_TEMP/sfw-wrappers" >> "$GITHUB_PATH"
129+
SHIM_DIR="$(cd scripts/sfw-shims && pwd)"
130+
echo "$SHIM_DIR" >> "$GITHUB_PATH"
152131
echo "REFLEX_USE_SYSTEM_BUN=1" >> "$GITHUB_ENV"
153132
154133
# Inline setup_build_env steps so all installs go through sfw.

scripts/sfw-shims/bun

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,17 @@ SHIM_DIR="$(cd "$(dirname "$0")" && pwd)"
44
export PATH="${PATH//$SHIM_DIR:/}"
55
export PATH="${PATH//:$SHIM_DIR/}"
66

7+
# Use sfw directly if available, otherwise fall back to npx sfw
8+
if command -v sfw >/dev/null 2>&1; then
9+
SFW=sfw
10+
else
11+
SFW="npx sfw"
12+
fi
13+
714
# Only route registry-touching commands through sfw
815
case "${1-}" in
916
install|add|update|pm)
10-
exec npx sfw bun "$@" ;;
17+
exec $SFW bun "$@" ;;
1118
*)
1219
exec bun "$@" ;;
1320
esac

scripts/sfw-shims/npm

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,17 @@ SHIM_DIR="$(cd "$(dirname "$0")" && pwd)"
44
export PATH="${PATH//$SHIM_DIR:/}"
55
export PATH="${PATH//:$SHIM_DIR/}"
66

7+
# Use sfw directly if available, otherwise fall back to npx sfw
8+
if command -v sfw >/dev/null 2>&1; then
9+
SFW=sfw
10+
else
11+
SFW="npx sfw"
12+
fi
13+
714
# Only route registry-touching commands through sfw
815
case "${1-}" in
916
install|ci|update|audit|pack|publish|fund|outdated)
10-
exec npx sfw npm "$@" ;;
17+
exec $SFW npm "$@" ;;
1118
*)
1219
exec npm "$@" ;;
1320
esac

0 commit comments

Comments
 (0)