- Makefile: add dev-backend (air) and dev-frontend (vite) targets - backend/.air.toml: air config for Go live reload - .gitignore: exclude backend/tmp/
77 lines
1.9 KiB
Makefile
77 lines
1.9 KiB
Makefile
.PHONY: build run test clean fmt lint frontend dev dev-backend dev-frontend
|
|
|
|
BINARY_NAME=openteam
|
|
BUILD_DIR=bin
|
|
BACKEND_DIR=backend
|
|
|
|
# Build
|
|
build: frontend
|
|
cd $(BACKEND_DIR) && CGO_ENABLED=0 go build -o ../$(BUILD_DIR)/$(BINARY_NAME) ./cmd/openteam
|
|
|
|
# Build frontend and copy dist
|
|
frontend:
|
|
cd frontend && pnpm install && pnpm build
|
|
rm -rf $(BACKEND_DIR)/cmd/openteam/dist
|
|
cp -r frontend/dist $(BACKEND_DIR)/cmd/openteam/dist
|
|
|
|
# Run
|
|
run: build
|
|
./$(BUILD_DIR)/$(BINARY_NAME)
|
|
|
|
# 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:
|
|
cd $(BACKEND_DIR) && go test ./internal/... -v
|
|
|
|
# Test with coverage
|
|
test-cover:
|
|
cd $(BACKEND_DIR) && go test ./internal/... -coverprofile=coverage.out
|
|
cd $(BACKEND_DIR) && go tool cover -html=coverage.out -o coverage.html
|
|
|
|
# Format code
|
|
fmt:
|
|
cd $(BACKEND_DIR) && go fmt ./...
|
|
|
|
# Lint
|
|
lint:
|
|
cd $(BACKEND_DIR) && golangci-lint run
|
|
|
|
# Clean
|
|
clean:
|
|
rm -rf $(BUILD_DIR)
|
|
cd $(BACKEND_DIR) && rm -f coverage.out coverage.html
|
|
|
|
# Tidy dependencies
|
|
tidy:
|
|
cd $(BACKEND_DIR) && go mod tidy
|
|
|
|
# Build for Linux
|
|
build-linux:
|
|
cd $(BACKEND_DIR) && CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o ../$(BUILD_DIR)/$(BINARY_NAME)-linux-amd64 ./cmd/openteam
|
|
|
|
# Build for macOS
|
|
build-mac:
|
|
cd $(BACKEND_DIR) && CGO_ENABLED=0 GOOS=darwin GOARCH=arm64 go build -o ../$(BUILD_DIR)/$(BINARY_NAME)-darwin-arm64 ./cmd/openteam
|
|
|
|
# Build all platforms
|
|
build-all: build-linux build-mac
|
|
|
|
# Database migration (will be implemented)
|
|
migrate:
|
|
@echo "Migration will be implemented in future"
|
|
|
|
# Seed data (will be implemented)
|
|
seed:
|
|
@echo "Seeding will be implemented in future"
|