chore: Add dev.sh tmux script to start server and frontend together

This commit is contained in:
Lukas May
2026-03-03 11:59:34 +01:00
parent b11cae998c
commit 8e77503941

29
dev.sh Executable file
View File

@@ -0,0 +1,29 @@
#!/usr/bin/env bash
# Start server + frontend in dev mode using tmux.
# Usage: ./dev.sh [session-name]
# ./dev.sh → session "cw"
# ./dev.sh myapp → session "myapp"
set -e
SESSION="${1:-cw}"
ROOT="$(cd "$(dirname "$0")" && pwd)"
if ! command -v tmux &>/dev/null; then
echo "tmux not found. Install with: brew install tmux" >&2
exit 1
fi
if tmux has-session -t "$SESSION" 2>/dev/null; then
echo "Session '$SESSION' already running — attaching."
exec tmux attach-session -t "$SESSION"
fi
tmux new-session -d -s "$SESSION" -n server -c "$ROOT"
tmux send-keys -t "$SESSION:server" "tsx watch apps/server/bin/cw.ts --server" Enter
tmux new-window -t "$SESSION" -n web -c "$ROOT"
tmux send-keys -t "$SESSION:web" "npm run dev --workspace=apps/web" Enter
tmux select-window -t "$SESSION:server"
exec tmux attach-session -t "$SESSION"