-
Notifications
You must be signed in to change notification settings - Fork 22
Expand file tree
/
Copy pathdev.sh
More file actions
executable file
·31 lines (26 loc) · 1.24 KB
/
Copy pathdev.sh
File metadata and controls
executable file
·31 lines (26 loc) · 1.24 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#!/usr/bin/env bash
# Dev mode, one port, hot-reload, no build step:
# - Go server (air, -tags dev) listens on :1431, serves /api + /v1 and proxies
# everything else (SPA + HMR) to the internal Vite server on :5174.
# - Open http://localhost:1431
set -euo pipefail
cd "$(dirname "$0")"
export ENOWX_PORT="${ENOWX_PORT:-1431}"
export ENOWX_VITE_PORT="${ENOWX_VITE_PORT:-5174}"
# Dev uses its own runtime dir so it never collides with an installed `enx`
# instance (shared PID file / SQLite DB).
export ENOWX_RUNTIME_DIR="${ENOWX_RUNTIME_DIR:-$HOME/.enowx-dev}"
# Dev talks to the staging cloud; the built-in default is production.
export ENOWX_SYNC_SERVER="${ENOWX_SYNC_SERVER:-https://api-dev.enowxlabs.com}"
command -v air >/dev/null 2>&1 || { echo "installing air…"; go install github.com/air-verse/air@latest; }
# Install frontend deps if missing (or if package.json changed since last install).
if [ ! -d web/node_modules ] || [ web/package.json -nt web/node_modules ]; then
echo "installing web deps…"
( cd web && npm install )
fi
cleanup() { kill 0 2>/dev/null || true; }
trap cleanup EXIT INT TERM
echo "▶ enowx dev on http://localhost:${ENOWX_PORT} (Go proxies → Vite :${ENOWX_VITE_PORT})"
( air ) &
( cd web && npm run dev ) &
wait