-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrun_web.sh
executable file
·40 lines (31 loc) · 884 Bytes
/
run_web.sh
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
30
31
32
33
34
35
36
37
38
39
40
#!/bin/bash
# build.sh
# Kill any existing ran process
pkill ran
# Initial build
xmake f -p wasm
xmake
# Store current directory
ROOT_DIR=$(pwd)
# Start ran in build directory in background
cd build/clay && ran -p 8000 &
RAN_PID=$!
# Go back to root for watching
cd "$ROOT_DIR"
# Trap to kill ran on script exit
trap 'pkill ran; exit 0' INT TERM EXIT
# Check if inotifywait exists
if ! command -v inotifywait &> /dev/null; then
echo "inotifywait not found. Please install inotify-tools"
echo "Ubuntu/Debian: sudo apt-get install inotify-tools"
echo "macOS: brew install fswatch"
# Just keep running without watch
while true; do
sleep 1
done
fi
# Watch for changes and rebuild
echo "Watching for changes in $ROOT_DIR/src and index.html"
while inotifywait -r -e modify "$ROOT_DIR/src" "$ROOT_DIR/index.html"; do
xmake f -p wasm && xmake
done