14 lines
922 B
Bash
Executable File
14 lines
922 B
Bash
Executable File
#!/usr/bin/env bash
|
|
# Vite dev server reachable from the LAN, wired to the local Supabase stack by the
|
|
# host's LAN address (the stack publishes 54321 / 54323 / 54324 on every interface).
|
|
# Usage: pnpm dev:lan [host-ip] (default: the first non-loopback IPv4 of this host)
|
|
set -euo pipefail
|
|
cd "$(dirname "$0")/.."
|
|
ip="${1:-$(hostname -I 2>/dev/null | awk '{print $1}')}"
|
|
[ -n "$ip" ] || { echo "dev-lan: pass the host IP as the first argument" >&2; exit 1; }
|
|
anon="$(node_modules/.bin/supabase status -o env 2>/dev/null | sed -n 's/^ANON_KEY="\(.*\)"$/\1/p')"
|
|
[ -n "$anon" ] || { echo "dev-lan: local stack not running (pnpm db:start)" >&2; exit 1; }
|
|
echo "== app http://$ip:5173 supabase http://$ip:54321 studio http://$ip:54323 mailpit http://$ip:54324"
|
|
VITE_SUPABASE_URL="http://$ip:54321" VITE_SUPABASE_ANON_KEY="$anon" \
|
|
exec node_modules/.bin/pnpm --filter @faunosteo/app exec vite --host 0.0.0.0 --port 5173
|