summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOwen Jacobson <owen@grimoire.ca>2024-11-22 18:26:46 -0500
committerOwen Jacobson <owen@grimoire.ca>2024-11-22 18:26:46 -0500
commit3c520be3ad06793a48c755921aefc17833ba0481 (patch)
tree2c8e19cbbc12ff06c8b7ff923f97a325d5ad53b1
parent2f6adda366dc372609f214682ca866c104fc278e (diff)
Dedicate `tools/run` to running the development server(s).
* It now _always_ runs both the backend and the frontend. * The frontend is now _always_ exposed on both `localhost` and on the machine's local network interfaces. The role of running a consolidated server is now handled by `cargo run` (this has been possible since e7d4b6d7ddbcd0128e47476e6cd1d824a1929f3c anyways).
-rwxr-xr-xtools/run21
1 files changed, 12 insertions, 9 deletions
diff --git a/tools/run b/tools/run
index 7f43a19..a9d52ee 100755
--- a/tools/run
+++ b/tools/run
@@ -1,14 +1,17 @@
#!/bin/bash -e
-## tools/run [ARGS...]
+## tools/run
+##
+## Runs the service, and runs a development version of the UI, with hot
+## reloading and live code changes enabled.
-if [ -z ${PILCROW_DEV+x} ]; then
- cargo run -- "$@"
-else
- npm run dev -- & PIDS[0]=$!
- cargo run -- "$@" & PIDS[1]=$!
+PIDS=()
- trap "kill ${PIDS[*]}" SIGINT
+trap 'kill ${PIDS[@]}' EXIT
- wait
-fi
+cargo run &
+PIDS+=($!)
+npm run dev -- --host &
+PIDS+=($!)
+
+wait "${PIDS[@]}"