kanban-app/Makefile

109 lines
No EOL
3.4 KiB
Makefile

.PHONY: help install dev-services dev-stop-services dev-backend dev-frontend dev build test lint clean up down restart logs
help: ## Show this help message
@echo "Available commands:"
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf " \033[36m%-20s\033[0m %s\n", $$1, $$2}'
install: ## Install dependencies
@echo "Installing backend dependencies..."
cd backend && python -m venv venv
. backend/venv/bin/activate && pip install -r backend/requirements/dev.txt
@echo "Installing frontend dependencies..."
cd frontend && npm install
dev-services: ## Start development services (postgres & redis only)
@echo "Starting development services (postgres & redis)..."
docker compose -f docker-compose.dev.yml up -d
dev-stop-services: ## Stop development services
@echo "Stopping development services..."
docker compose -f docker-compose.dev.yml down
dev-backend: ## Start backend server locally
@echo "Starting backend server..."
cd backend && source venv/bin/activate && flask run
dev-frontend: ## Start frontend server locally
@echo "Starting frontend server..."
cd frontend && npm run dev
dev: ## Start development environment
@echo "Starting development environment..."
docker-compose -f docker-compose.dev.yml up -d
@echo "In one terminal run: make dev-backend"
@echo "In another terminal run: make dev-frontend"
build: ## Build Docker images
@echo "Building Docker images..."
docker compose build
up: ## Start all services
@echo "Starting all services..."
docker compose up -d
down: ## Stop all services
@echo "Stopping all services..."
docker compose down
restart: ## Restart all services
@echo "Restarting all services..."
docker compose restart
logs: ## Show logs from all services
docker compose logs -f
logs-backend: ## Show backend logs
docker compose logs -f backend
logs-frontend: ## Show frontend logs
docker compose logs -f frontend
test: ## Run all tests
@echo "Running backend tests..."
cd backend && . venv/bin/activate && pytest
@echo "Running frontend tests..."
cd frontend && npm test
test-backend: ## Run backend tests only
cd backend && . venv/bin/activate && pytest
test-frontend: ## Run frontend tests only
cd frontend && npm test
lint: ## Run linting
@echo "Linting backend..."
cd backend && . venv/bin/activate && flake8 app tests
@echo "Linting frontend..."
cd frontend && npm run lint
lint-backend: ## Lint backend only
cd backend && . venv/bin/activate && flake8 app tests
lint-frontend: ## Lint frontend only
cd frontend && npm run lint
format: ## Format code
@echo "Formatting backend..."
cd backend && . venv/bin/activate && black app tests && isort app tests
@echo "Formatting frontend..."
cd frontend && npx prettier --write "src/**/*.{js,jsx,ts,tsx,css}"
migrate: ## Run database migrations
cd backend && . venv/bin/activate && flask db upgrade
shell: ## Open Flask shell
cd backend && . venv/bin/activate && flask shell
clean: ## Clean up build artifacts
@echo "Cleaning up..."
cd backend && rm -rf __pycache__ *.pyc .pytest_cache
cd frontend && rm -rf dist node_modules/.cache
prune: ## Remove unused Docker resources
docker system prune -a
backup: ## Backup database
docker exec crafting-shop-postgres pg_dump -U crafting crafting_shop > backup.sql
restore: ## Restore database (usage: make restore FILE=backup.sql)
docker exec -i crafting-shop-postgres psql -U crafting crafting_shop < $(FILE)