Files
rxminder/Makefile

244 lines
6.8 KiB
Makefile

# Makefile for Medication Reminder App
# Acts as a wrapper for package.json scripts with organized targets
.PHONY: help install clean build dev test lint deploy docker gitea k8s
# Default target
.DEFAULT_GOAL := help
# Colors for output
BLUE := \033[34m
GREEN := \033[32m
YELLOW := \033[33m
RED := \033[31m
RESET := \033[0m
##@ General
help: ## Display this help message
@echo "$(BLUE)Medication Reminder App - Available Commands$(RESET)"
@echo ""
@awk 'BEGIN {FS = ":.*##"} /^[a-zA-Z_0-9-]+:.*?##/ { printf " $(GREEN)%-20s$(RESET) %s\n", $$1, $$2 } /^##@/ { printf "\n$(YELLOW)%s$(RESET)\n", substr($$0, 5) } ' $(MAKEFILE_LIST)
install: ## Install dependencies
@echo "$(BLUE)Installing dependencies...$(RESET)"
@bun install
clean: ## Clean build artifacts and dependencies
@echo "$(BLUE)Cleaning up...$(RESET)"
@rm -rf node_modules dist build .cache
##@ Development
dev: ## Start development server
@echo "$(BLUE)Starting development server...$(RESET)"
@bun run dev
build: ## Build the application
@echo "$(BLUE)Building application...$(RESET)"
@bun run build
preview: ## Preview the built application
@echo "$(BLUE)Starting preview server...$(RESET)"
@bun run preview
##@ Testing
test: ## Run unit tests
@echo "$(BLUE)Running unit tests...$(RESET)"
@bun run test
test-watch: ## Run unit tests in watch mode
@echo "$(BLUE)Running tests in watch mode...$(RESET)"
@bun run test:watch
test-coverage: ## Run tests with coverage
@echo "$(BLUE)Running tests with coverage...$(RESET)"
@bun run test:coverage
test-integration: ## Run integration tests
@echo "$(BLUE)Running integration tests...$(RESET)"
@bun run test:integration
test-e2e: ## Run end-to-end tests
@echo "$(BLUE)Running e2e tests...$(RESET)"
@bun run test:e2e
test-e2e-ui: ## Run e2e tests with UI
@echo "$(BLUE)Running e2e tests with UI...$(RESET)"
@bun run test:e2e:ui
test-e2e-debug: ## Debug e2e tests
@echo "$(BLUE)Debugging e2e tests...$(RESET)"
@bun run test:e2e:debug
test-e2e-report: ## Show e2e test report
@echo "$(BLUE)Showing e2e test report...$(RESET)"
@bun run test:e2e:report
test-all: ## Run all tests (unit + integration + e2e)
@echo "$(BLUE)Running all tests...$(RESET)"
@bun run test:all
##@ Code Quality
lint: ## Run all linting checks
@echo "$(BLUE)Running linting checks...$(RESET)"
@bun run lint
lint-fix: ## Fix linting issues
@echo "$(BLUE)Fixing linting issues...$(RESET)"
@bun run lint:fix
lint-markdown: ## Lint markdown files
@echo "$(BLUE)Linting markdown files...$(RESET)"
@bun run lint:markdown
lint-markdown-fix: ## Fix markdown linting issues
@echo "$(BLUE)Fixing markdown linting issues...$(RESET)"
@bun run lint:markdown:fix
lint-docker: ## Lint Dockerfile
@echo "$(BLUE)Linting Dockerfile...$(RESET)"
@bun run lint:docker
check-secrets: ## Check for secrets in code
@echo "$(BLUE)Checking for secrets...$(RESET)"
@bun run check:secrets
check-editorconfig: ## Check EditorConfig compliance
@echo "$(BLUE)Checking EditorConfig compliance...$(RESET)"
@bun run check:editorconfig
fix-editorconfig: ## Fix EditorConfig issues
@echo "$(BLUE)Fixing EditorConfig issues...$(RESET)"
@bun run fix:editorconfig
pre-commit: ## Run pre-commit checks
@echo "$(BLUE)Running pre-commit checks...$(RESET)"
@bun run pre-commit
##@ Setup & Deployment
setup: ## Setup the project
@echo "$(BLUE)Setting up project...$(RESET)"
@bun run setup
deploy: ## Deploy the application
@echo "$(BLUE)Deploying application...$(RESET)"
@bun run deploy
validate-env: ## Validate environment configuration
@echo "$(BLUE)Validating environment...$(RESET)"
@bun run validate:env
validate-deployment: ## Validate deployment
@echo "$(BLUE)Validating deployment...$(RESET)"
@bun run validate:deployment
seed-production: ## Seed production database
@echo "$(BLUE)Seeding production database...$(RESET)"
@bun run seed:production
##@ Kubernetes
k8s-deploy: ## Deploy to Kubernetes
@echo "$(BLUE)Deploying to Kubernetes...$(RESET)"
@bun run deploy:k8s
k8s-undeploy: ## Remove from Kubernetes
@echo "$(BLUE)Removing from Kubernetes...$(RESET)"
@bun run undeploy:k8s
k8s-deploy-dry: ## Dry run Kubernetes deployment
@echo "$(BLUE)Dry run Kubernetes deployment...$(RESET)"
@bun run deploy:k8s --dry-run
k8s-undeploy-dry: ## Dry run Kubernetes removal
@echo "$(BLUE)Dry run Kubernetes removal...$(RESET)"
@bun run undeploy:k8s --dry-run
k8s-status: ## Show Kubernetes deployment status
@echo "$(BLUE)Showing Kubernetes status...$(RESET)"
@bun run deploy:k8s --status
##@ Docker
docker-setup: ## Setup Docker buildx
@echo "$(BLUE)Setting up Docker buildx...$(RESET)"
@bun run docker:setup
docker-build: ## Build multi-platform Docker images
@echo "$(BLUE)Building multi-platform Docker images...$(RESET)"
@bun run docker:build
docker-build-local: ## Build local Docker image
@echo "$(BLUE)Building local Docker image...$(RESET)"
@bun run docker:build-local
docker-bake: ## Build with Docker Bake
@echo "$(BLUE)Building with Docker Bake...$(RESET)"
@bun run docker:bake
docker-inspect: ## Inspect Docker buildx
@echo "$(BLUE)Inspecting Docker buildx...$(RESET)"
@bun run docker:inspect
docker-cleanup: ## Cleanup Docker buildx
@echo "$(BLUE)Cleaning up Docker buildx...$(RESET)"
@bun run docker:cleanup
##@ Gitea
gitea-setup: ## Setup Gitea integration
@echo "$(BLUE)Setting up Gitea integration...$(RESET)"
@bun run gitea:setup
gitea-build: ## Build multi-platform images for Gitea
@echo "$(BLUE)Building multi-platform images for Gitea...$(RESET)"
@bun run gitea:build
gitea-build-local: ## Build local image for Gitea
@echo "$(BLUE)Building local image for Gitea...$(RESET)"
@bun run gitea:build-local
gitea-build-staging: ## Build staging image for Gitea
@echo "$(BLUE)Building staging image for Gitea...$(RESET)"
@bun run gitea:build-staging
gitea-build-prod: ## Build production image for Gitea
@echo "$(BLUE)Building production image for Gitea...$(RESET)"
@bun run gitea:build-prod
gitea-test: ## Test Gitea integration
@echo "$(BLUE)Testing Gitea integration...$(RESET)"
@bun run gitea:test
gitea-deploy: ## Deploy to Gitea
@echo "$(BLUE)Deploying to Gitea...$(RESET)"
@bun run gitea:deploy
gitea-status: ## Show Gitea deployment status
@echo "$(BLUE)Showing Gitea status...$(RESET)"
@bun run gitea:status
gitea-cleanup: ## Cleanup Gitea resources
@echo "$(BLUE)Cleaning up Gitea resources...$(RESET)"
@bun run gitea:cleanup
##@ Quick Commands
start: dev ## Alias for dev (start development server)
build-and-test: build test ## Build and run tests
@echo "$(GREEN)Build and test completed!$(RESET)"
full-check: lint test-all ## Run full code quality check
@echo "$(GREEN)Full check completed!$(RESET)"
quick-deploy: build k8s-deploy ## Quick build and deploy to Kubernetes
@echo "$(GREEN)Quick deployment completed!$(RESET)"
reset: clean install ## Reset project (clean and reinstall)
@echo "$(GREEN)Project reset completed!$(RESET)"