-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
114 lines (100 loc) · 3.98 KB
/
Makefile
File metadata and controls
114 lines (100 loc) · 3.98 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
# ============================================================================
# Epitrello Makefile
# ============================================================================
.PHONY: help install setup docker-start docker-stop docker-restart \
docker-backend docker-frontend dev-backend dev-frontend \
build-backend build-frontend db-up db-down db-reset db-migrate \
prisma-generate prisma-studio test test-backend \
lint lint-backend lint-frontend format format-backend \
clean clean-backend clean-frontend
# Variables
DOCKER_COMPOSE = docker-compose
DOCKER_COMPOSE_DEV = docker-compose -f docker-compose.dev.yml
BACKEND_DIR = backend
FRONTEND_DIR = frontend
SCRIPTS_DIR = scripts
# Help
help: ## Display available commands
@echo "Epitrello - Available Commands"
@echo "=============================="
@grep -E '^[a-zA-Z0-9_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf " \033[36m%-20s\033[0m %s\n", $$1, $$2}'
# Setup & Installation
install: install-backend install-frontend ## Install all dependencies
install-backend: ## Install backend dependencies
cd $(BACKEND_DIR) && pnpm install --frozen-lockfile
install-frontend: ## Install frontend dependencies
cd $(FRONTEND_DIR) && pnpm install --frozen-lockfile
setup: install prisma-generate ## Complete project setup
# Docker Services
docker-start: ## Start all Docker services
@$(SCRIPTS_DIR)/docker-start-services.sh
docker-stop: ## Stop all Docker services
@$(SCRIPTS_DIR)/docker-stop-services.sh
docker-restart: ## Restart all Docker services
@$(SCRIPTS_DIR)/docker-restart-services.sh
docker-logs: ## View logs from all Docker services
@$(DOCKER_COMPOSE) logs -f
docker-ps: ## Show status of all Docker services
@$(DOCKER_COMPOSE) ps
# Docker Individual Services
docker-backend: db-up ## Start backend in Docker
@echo "Starting backend in Docker..."
@$(DOCKER_COMPOSE) up -d backend
@echo "Backend is running at http://localhost:4000/graphql"
docker-frontend: ## Start frontend in Docker
@echo "Starting frontend in Docker..."
@$(DOCKER_COMPOSE) up -d frontend
@echo "Frontend is running at http://localhost:3000"
# Development (Local)
dev-backend: ## Start backend in development mode (local)
cd $(BACKEND_DIR) && pnpm start:dev
dev-frontend: ## Start frontend in development mode (local)
cd $(FRONTEND_DIR) && pnpm dev
# Build
build-backend: ## Build backend for production
cd $(BACKEND_DIR) && pnpm build
build-frontend: ## Build frontend for production
cd $(FRONTEND_DIR) && pnpm build
# Database Operations
db-up: ## Start PostgreSQL database
@$(DOCKER_COMPOSE_DEV) up -d postgres
db-down: ## Stop PostgreSQL database
@$(DOCKER_COMPOSE_DEV) down postgres
db-reset: ## Reset database (WARNING: deletes all data)
@read -p "Are you sure? [y/N] " -n 1 -r; \
echo; \
if [[ $$REPLY =~ ^[Yy]$$ ]]; then \
set -a; [ -f .env ] && . .env; set +a; \
cd $(BACKEND_DIR) && pnpm prisma migrate reset --force; \
fi
db-migrate: ## Create and apply a new Prisma migration
@read -p "Migration name: " name; \
set -a; [ -f .env ] && . .env; set +a; \
cd $(BACKEND_DIR) && pnpm prisma migrate dev --name $$name
# Prisma
prisma-generate: ## Generate Prisma Client
@set -a; [ -f .env ] && . .env; set +a; \
cd $(BACKEND_DIR) && pnpm prisma generate
prisma-studio: ## Open Prisma Studio
@set -a; [ -f .env ] && . .env; set +a; \
cd $(BACKEND_DIR) && pnpm prisma studio
# Testing
test: test-backend ## Run all tests
test-backend: ## Run backend unit tests
cd $(BACKEND_DIR) && pnpm test
# Code Quality
lint: lint-backend lint-frontend ## Lint all code
lint-backend: ## Lint backend code
cd $(BACKEND_DIR) && pnpm lint
lint-frontend: ## Lint frontend code
cd $(FRONTEND_DIR) && pnpm lint
format: format-backend ## Format all code
format-backend: ## Format backend code
cd $(BACKEND_DIR) && pnpm format
# Cleanup
clean: clean-backend clean-frontend ## Clean build artifacts
clean-backend: ## Clean backend build artifacts
rm -rf $(BACKEND_DIR)/dist
clean-frontend: ## Clean frontend build artifacts
rm -rf $(FRONTEND_DIR)/.next
.DEFAULT_GOAL := help