feat: Implement initial Go backend and React frontend project structure for the gotail application.
This commit is contained in:
@@ -0,0 +1,64 @@
|
||||
.PHONY: help build dev-backend dev-frontend test lint docker-build docker-run clean
|
||||
|
||||
help: ## Show this help
|
||||
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-20s\033[0m %s\n", $$1, $$2}'
|
||||
|
||||
build: ## Build production binary
|
||||
@echo "Building frontend..."
|
||||
cd frontend && npm install --legacy-peer-deps && npm run build
|
||||
@echo "Building backend..."
|
||||
rm -rf backend/dist
|
||||
mkdir -p backend/dist
|
||||
cp -r frontend/dist/* backend/dist/
|
||||
cd backend && go build -ldflags="-X main.version=2.0.0" -o ../web-tail-pro ./cmd/server
|
||||
@echo "Build complete: ./web-tail-pro"
|
||||
|
||||
dev-backend: ## Run backend in development mode
|
||||
cd backend && go run ./cmd/server/main.go logs/*.log
|
||||
|
||||
dev-frontend: ## Run frontend in development mode
|
||||
cd frontend && npm run dev
|
||||
|
||||
test: ## Run tests
|
||||
cd backend && go test -v -race -coverprofile=coverage.out ./...
|
||||
cd frontend && npm test
|
||||
|
||||
test-coverage: ## Generate test coverage report
|
||||
cd backend && go test -v -race -coverprofile=coverage.out ./... && go tool cover -html=coverage.out
|
||||
|
||||
lint: ## Run linters
|
||||
cd backend && golangci-lint run
|
||||
cd frontend && npm run lint
|
||||
|
||||
fmt: ## Format code
|
||||
cd backend && go fmt ./...
|
||||
cd frontend && npm run format
|
||||
|
||||
docker-build: ## Build Docker image
|
||||
docker build -t webtail:latest .
|
||||
|
||||
docker-run: ## Run Docker container
|
||||
docker run -p 8080:8080 -v $(PWD)/backend/logs:/logs:ro webtail:latest /logs/app.log
|
||||
|
||||
docker-compose-up: ## Start with docker-compose
|
||||
docker-compose up -d
|
||||
|
||||
docker-compose-down: ## Stop docker-compose
|
||||
docker-compose down
|
||||
|
||||
clean: ## Clean build artifacts
|
||||
rm -rf backend/dist
|
||||
rm -rf frontend/dist
|
||||
rm -rf frontend/node_modules
|
||||
rm -f web-tail-pro
|
||||
rm -f backend/coverage.out
|
||||
|
||||
deps: ## Install dependencies
|
||||
cd backend && go mod download
|
||||
cd frontend && npm install --legacy-peer-deps
|
||||
|
||||
update-deps: ## Update dependencies
|
||||
cd backend && go get -u ./... && go mod tidy
|
||||
cd frontend && npm update
|
||||
|
||||
.DEFAULT_GOAL := help
|
||||
Reference in New Issue
Block a user