Skip to content

Commit

Permalink
chore: add dev rule to start otto8 and the admin ui
Browse files Browse the repository at this point in the history
Signed-off-by: Nick Hale <[email protected]>
  • Loading branch information
njhale committed Oct 16, 2024
1 parent c5294da commit faefe47
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 1 deletion.
6 changes: 5 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,8 @@ clean:
build:
go build -o bin/otto -v

.PHONY: ui build all clean
dev: ui
@echo "Starting dev otto server and admin UI..."
./dev.sh

.PHONY: ui build all clean dev
23 changes: 23 additions & 0 deletions dev.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/bin/bash

cleanup() {
echo "Terminating processes..."
kill 0
}

trap cleanup EXIT

# Start the otto server
go run main.go server --dev-mode 2>&1 | while IFS= read -r line; do
printf "\033[38;5;183m[server]\033[0m %s\n" "$line"
done &
otto_pid=$!

# Start the admin UI
cd ui/admin && VITE_API_IN_BROWSER=true npm run dev 2>&1 | while IFS= read -r line; do
printf "\033[38;5;153m[admin-ui]\033[0m %s\n" "$line"
done &
npm_pid=$!

# Wait for both processes to finish
wait "$otto_pid" "$npm_pid"

0 comments on commit faefe47

Please sign in to comment.