-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathutilities.sh
More file actions
38 lines (35 loc) · 907 Bytes
/
utilities.sh
File metadata and controls
38 lines (35 loc) · 907 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
30
31
32
33
34
35
36
37
38
#!/usr/bin/env bash
function cleanup() {
return_code="$?"
echo "[INFO] Stopping the development server..."
for job in $( jobs -p ); do
kill -SIGTERM "${job}"
if ! wait "${job}"; then
echo "[WARN] Child job ${job} exited with $?."
fi
done
rm -f login.json
echo "[INFO] Cleaning up .next directory..."
rm -rf .next
if [[ "${return_code}" = "0" ]]; then
echo "[INFO] Database at dev.db seeded!"
else
echo "[FAIL] Database at dev.db failed to seed!"
fi
}
function setup_dev_server() {
echo "[INFO] Starting the development server..."
rm -rf dev.db dev.db-shm dev.db-wal
sqlite3 dev.db -- 'PRAGMA journal_mode=WAL;'
set +o errexit
pnpm dev &
set -o errexit
for (( i = 0; i < 10; i++ )); do
if ! curl -s http://localhost:3000 >/dev/null; then
echo "Dev server not yet started, waiting..."
sleep 1
else
break
fi
done
}