chore: Move dev.sh into workdir/ with correct working directory
This commit is contained in:
5
.gitignore
vendored
5
.gitignore
vendored
@@ -23,8 +23,9 @@ Thumbs.db
|
||||
# Local data
|
||||
.cw/
|
||||
|
||||
# Test workspaces
|
||||
workdir/
|
||||
# Test workspaces (keep dev.sh tracked)
|
||||
workdir/*
|
||||
!workdir/dev.sh
|
||||
|
||||
# Agent working directories
|
||||
agent-workdirs/
|
||||
|
||||
@@ -1,13 +1,15 @@
|
||||
#!/usr/bin/env bash
|
||||
# Start server + frontend in dev mode using tmux.
|
||||
# Run from workdir/ — this directory is the CW workspace.
|
||||
# Usage: ./dev.sh [session-name]
|
||||
# ./dev.sh → session "cw"
|
||||
# ./dev.sh myapp → session "myapp"
|
||||
# ./dev.sh myapp → custom session name
|
||||
|
||||
set -e
|
||||
|
||||
SESSION="${1:-cw}"
|
||||
ROOT="$(cd "$(dirname "$0")" && pwd)"
|
||||
WORKDIR="$(cd "$(dirname "$0")" && pwd)"
|
||||
ROOT="$(cd "$WORKDIR/.." && pwd)"
|
||||
|
||||
if ! command -v tmux &>/dev/null; then
|
||||
echo "tmux not found. Install with: brew install tmux" >&2
|
||||
@@ -19,9 +21,11 @@ if tmux has-session -t "$SESSION" 2>/dev/null; then
|
||||
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
|
||||
# Server: runs from workdir/ so cw finds .cwrc here
|
||||
tmux new-session -d -s "$SESSION" -n server -c "$WORKDIR"
|
||||
tmux send-keys -t "$SESSION:server" "tsx watch $ROOT/apps/server/bin/cw.ts --server" Enter
|
||||
|
||||
# Frontend: runs from project root via npm workspace
|
||||
tmux new-window -t "$SESSION" -n web -c "$ROOT"
|
||||
tmux send-keys -t "$SESSION:web" "npm run dev --workspace=apps/web" Enter
|
||||
|
||||
Reference in New Issue
Block a user