-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdev.sh
More file actions
executable file
·29 lines (22 loc) · 851 Bytes
/
dev.sh
File metadata and controls
executable file
·29 lines (22 loc) · 851 Bytes
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
#!/usr/bin/env bash
set -euo pipefail
SESSION="pathfinding-dev"
DIR="$(cd "$(dirname "$0")" && pwd)"
# ---------------------------------------------------------------
# Install dependencies if needed
# ---------------------------------------------------------------
if [ ! -d "$DIR/node_modules" ]; then
echo "Installing dependencies..."
cd "$DIR" && npm install
fi
# ---------------------------------------------------------------
# Kill existing session if it exists
tmux kill-session -t "$SESSION" 2>/dev/null || true
# Kill any lingering process on port 8080
fuser -k 8080/tcp 2>/dev/null || true
sleep 1
tmux new-session -d -s "$SESSION" -n server \
"cd $DIR && npx http-server visual -p 8080 -c-1; read"
tmux new-window -t "$SESSION" -n tests \
"cd $DIR && npx mocha --require should test/**/*.js; read"
tmux attach -t "$SESSION"