chore: add hot reload for development

- Makefile: add dev-backend (air) and dev-frontend (vite) targets
- backend/.air.toml: air config for Go live reload
- .gitignore: exclude backend/tmp/
This commit is contained in:
Sakurasan
2026-08-30 15:33:16 +08:00
parent f3af42a65f
commit 6cc76c6767
3 changed files with 51 additions and 4 deletions
+12 -4
View File
@@ -1,4 +1,4 @@
.PHONY: build run test clean fmt lint frontend
.PHONY: build run test clean fmt lint frontend dev dev-backend dev-frontend
BINARY_NAME=openteam
BUILD_DIR=bin
@@ -18,9 +18,17 @@ frontend:
run: build
./$(BUILD_DIR)/$(BINARY_NAME)
# Development run
dev:
cd $(BACKEND_DIR) && go run ./cmd/openteam
# Development: backend + frontend (requires air + pnpm)
dev: dev-backend dev-frontend
# Go backend with hot reload (requires: go install github.com/air-verse/air@latest)
dev-backend:
@command -v air >/dev/null 2>&1 || { echo "Installing air..."; go install github.com/air-verse/air@latest; }
cd $(BACKEND_DIR) && air -c .air.toml
# Vue frontend with HMR
dev-frontend:
cd frontend && pnpm dev
# Test
test: