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:
@@ -1,4 +1,5 @@
|
|||||||
bin/
|
bin/
|
||||||
|
tmp/
|
||||||
test/
|
test/
|
||||||
demo/
|
demo/
|
||||||
*.log
|
*.log
|
||||||
|
|||||||
@@ -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
|
BINARY_NAME=openteam
|
||||||
BUILD_DIR=bin
|
BUILD_DIR=bin
|
||||||
@@ -18,9 +18,17 @@ frontend:
|
|||||||
run: build
|
run: build
|
||||||
./$(BUILD_DIR)/$(BINARY_NAME)
|
./$(BUILD_DIR)/$(BINARY_NAME)
|
||||||
|
|
||||||
# Development run
|
# Development: backend + frontend (requires air + pnpm)
|
||||||
dev:
|
dev: dev-backend dev-frontend
|
||||||
cd $(BACKEND_DIR) && go run ./cmd/openteam
|
|
||||||
|
# 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
|
||||||
test:
|
test:
|
||||||
|
|||||||
@@ -0,0 +1,38 @@
|
|||||||
|
# Air configuration for Go hot reload
|
||||||
|
# Docs: https://github.com/air-verse/air
|
||||||
|
|
||||||
|
root = "."
|
||||||
|
tmp_dir = "tmp"
|
||||||
|
|
||||||
|
[build]
|
||||||
|
bin = "./tmp/main"
|
||||||
|
cmd = "go build -o ./tmp/main ./cmd/openteam"
|
||||||
|
delay = 1000
|
||||||
|
exclude_dir = ["tmp", "vendor", "node_modules", "frontend"]
|
||||||
|
exclude_file = []
|
||||||
|
exclude_regex = ["_test.go", ".*_test.go"]
|
||||||
|
exclude_unchanged = false
|
||||||
|
follow_symlink = false
|
||||||
|
include_dir = []
|
||||||
|
include_ext = ["go", "tpl", "tmpl", "html", "sql"]
|
||||||
|
kill_delay = "0s"
|
||||||
|
log = "build-errors.log"
|
||||||
|
send_interrupt = false
|
||||||
|
stop_on_error = true
|
||||||
|
|
||||||
|
[color]
|
||||||
|
build = "yellow"
|
||||||
|
main = "magenta"
|
||||||
|
runner = "green"
|
||||||
|
watcher = "cyan"
|
||||||
|
|
||||||
|
[log]
|
||||||
|
main_only = false
|
||||||
|
time = false
|
||||||
|
|
||||||
|
[misc]
|
||||||
|
clean_on_exit = false
|
||||||
|
|
||||||
|
[screen]
|
||||||
|
clear_on_rebuild = false
|
||||||
|
keep_scroll = true
|
||||||
Reference in New Issue
Block a user