Diffdown is a real-time collaborative Markdown editor/previewer built on the AT Protocol
diffdown.com
1.PHONY: help build run test clean migrate-up migrate-down docker-up docker-down
2
3help: ## Show this help message
4 @echo 'Usage: make [target]'
5 @echo ''
6 @echo 'Available targets:'
7 @awk 'BEGIN {FS = ":.*?## "} /^[a-zA-Z_-]+:.*?## / {printf " %-15s %s\n", $$1, $$2}' $(MAKEFILE_LIST)
8
9build: ## Build the application
10 @echo "Building..."
11 @go build -o bin/server ./cmd/server
12
13run: ## Run the application
14 @echo "Running..."
15 @go run ./cmd/server
16
17test: ## Run tests
18 @echo "Running tests..."
19 @go test -v ./...
20
21test-coverage: ## Run tests with coverage
22 @echo "Running tests with coverage..."
23 @go test -v -coverprofile=coverage.out ./...
24 @go tool cover -html=coverage.out -o coverage.html
25
26lint: ## Run linter
27 @echo "Running linter..."
28 @golangci-lint run
29
30fmt: ## Format code
31 @echo "Formatting code..."
32 @go fmt ./...
33
34clean: ## Clean build artifacts
35 @echo "Cleaning..."
36 @rm -rf bin/
37 @rm -f coverage.out coverage.html
38
39migrate-up: ## Run database migrations up
40 @echo "Running migrations up..."
41 @go run cmd/migrate/main.go up
42
43migrate-down: ## Run database migrations down
44 @echo "Running migrations down..."
45 @go run cmd/migrate/main.go down
46
47migrate-create: ## Create a new migration (usage: make migrate-create name=create_users_table)
48 @echo "Creating migration: $(name)"
49 @go run cmd/migrate/main.go create $(name)
50
51docker-up: ## Start Docker services
52 @echo "Starting Docker services..."
53 @docker-compose up -d
54
55docker-down: ## Stop Docker services
56 @echo "Stopping Docker services..."
57 @docker-compose down
58
59docker-logs: ## View Docker logs
60 @docker-compose logs -f
61
62dev: ## Run in development mode with hot reload
63 @echo "Starting development server..."
64 @air
65
66install-tools: ## Install development tools
67 @echo "Installing development tools..."
68 @go install github.com/cosmtrek/air@latest
69 @go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest