Files
Toju/dev.sh
T
myxelium e49b3ec112 chore: dev-stack switches, shared e2e harness, and desktop shell rules
- `LIVE_RELOAD=false npm run dev` keeps the renderer alive across a machine
  suspend; the reload client otherwise destroys the session under test.
- `dev-peer.sh` plus a separate userdata dir runs a second local peer.
- `tools/voice-probe.js` samples peer state and RTP counters from a live
  window, persisting to localStorage so a renderer reload cannot erase it.
- e2e helpers for voice pairs, peer-role election, and a TURN relay.
- Electron single-instance and dev-client-load decisions move into rules
  files with colocated specs.
2026-08-14 03:19:29 +02:00

50 lines
1.7 KiB
Bash
Executable File

#!/usr/bin/env bash
# Launch the full dev stack, respecting SSL= from .env
set -e
DIR="$(cd "$(dirname "$0")" && pwd)"
# Load .env
if [ -f "$DIR/.env" ]; then
set -a
source "$DIR/.env"
set +a
fi
SSL="${SSL:-false}"
LIVE_RELOAD="${LIVE_RELOAD:-true}"
# Suspending the machine tears down the dev-server connection. The live-reload client
# answers the reconnect by reloading the page, which destroys the very session under
# test (voice call, peer connections, console state). Set LIVE_RELOAD=false to keep the
# renderer alive across a suspend. Editing client files then has no effect until restart.
NG_RELOAD_FLAG=""
if [ "$LIVE_RELOAD" != "true" ]; then
NG_RELOAD_FLAG=" --live-reload=false"
echo "Live reload disabled: client edits will NOT reach the running window."
fi
if [ "$SSL" = "true" ]; then
# Ensure certs exist
if [ ! -f "$DIR/.certs/localhost.crt" ]; then
echo "SSL=true but no certs found. Generating..."
"$DIR/generate-cert.sh"
fi
NG_SERVE="cd toju-app && npx ng serve --host=0.0.0.0 --ssl --ssl-cert=../.certs/localhost.crt --ssl-key=../.certs/localhost.key$NG_RELOAD_FLAG"
# Use 127.0.0.1 so wait-on does not hit a stale HTTP listener on localhost (::1).
WAIT_URL="https://127.0.0.1:4200"
HEALTH_URL="https://127.0.0.1:3001/api/health"
export NODE_TLS_REJECT_UNAUTHORIZED=0
else
NG_SERVE="cd toju-app && npx ng serve --host=0.0.0.0$NG_RELOAD_FLAG"
WAIT_URL="http://127.0.0.1:4200"
HEALTH_URL="http://127.0.0.1:3001/api/health"
fi
exec npx concurrently --kill-others \
"cd server && npm run dev" \
"$NG_SERVE" \
"wait-on $WAIT_URL $HEALTH_URL && cross-env NODE_ENV=development SSL=$SSL node tools/launch-electron.js . --no-sandbox --disable-dev-shm-usage"