chore: Switch dev.sh to side-by-side split layout (server | web)
This commit is contained in:
@@ -1,9 +1,8 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
# Start server + frontend in dev mode using tmux.
|
# Start server + frontend in dev mode using tmux.
|
||||||
# Run from workdir/ — this directory is the CW workspace.
|
# Run from workdir/ — this directory is the CW workspace.
|
||||||
|
# Layout: server (left) | web (right)
|
||||||
# Usage: ./dev.sh [session-name]
|
# Usage: ./dev.sh [session-name]
|
||||||
# ./dev.sh → session "cw"
|
|
||||||
# ./dev.sh myapp → custom session name
|
|
||||||
|
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
@@ -21,13 +20,20 @@ if tmux has-session -t "$SESSION" 2>/dev/null; then
|
|||||||
exec tmux attach-session -t "$SESSION"
|
exec tmux attach-session -t "$SESSION"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Server: runs from workdir/ so cw finds .cwrc here
|
# Single window, split vertically: server on left, web on right
|
||||||
tmux new-session -d -s "$SESSION" -n server -c "$WORKDIR"
|
tmux new-session -d -s "$SESSION" -n dev -c "$WORKDIR"
|
||||||
tmux send-keys -t "$SESSION:server" "npx tsx watch $ROOT/apps/server/bin/cw.ts --server" Enter
|
|
||||||
|
|
||||||
# Frontend: runs from project root via npm workspace
|
# Left pane: server (runs from workdir/ so cw finds .cwrc here)
|
||||||
tmux new-window -t "$SESSION" -n web -c "$ROOT"
|
tmux send-keys -t "$SESSION:dev" "npx tsx watch $ROOT/apps/server/bin/cw.ts --server" Enter
|
||||||
tmux send-keys -t "$SESSION:web" "npm run dev --workspace=apps/web" Enter
|
|
||||||
|
# Right pane: web dev server
|
||||||
|
tmux split-window -t "$SESSION:dev" -h -c "$ROOT"
|
||||||
|
tmux send-keys -t "$SESSION:dev" "npm run dev --workspace=apps/web" Enter
|
||||||
|
|
||||||
|
# Give server pane slightly more width (60/40 split)
|
||||||
|
tmux resize-pane -t "$SESSION:dev.left" -x "60%"
|
||||||
|
|
||||||
|
# Keep focus on server pane
|
||||||
|
tmux select-pane -t "$SESSION:dev.left"
|
||||||
|
|
||||||
tmux select-window -t "$SESSION:server"
|
|
||||||
exec tmux attach-session -t "$SESSION"
|
exec tmux attach-session -t "$SESSION"
|
||||||
|
|||||||
Reference in New Issue
Block a user