- Reduce from 400+ lines to 58 lines (85% reduction) - Keep only essential commands: build, test, dev, docker-build - Remove deployment-specific targets (k8s, complex workflows) - Preserve multi-architecture Docker buildx support - Improve maintainability and focus on development needs
59 lines
1.5 KiB
Makefile
59 lines
1.5 KiB
Makefile
# Makefile for Medication Reminder App
|
|
|
|
.PHONY: help install clean dev build test docker-build docker-clean
|
|
|
|
# Default target
|
|
.DEFAULT_GOAL := help
|
|
|
|
##@ General
|
|
|
|
help: ## Display available commands
|
|
@awk 'BEGIN {FS = ":.*##"} /^[a-zA-Z_0-9-]+:.*?##/ { printf " %-20s %s\n", $$1, $$2 } /^##@/ { printf "\n%s\n", substr($$0, 5) } ' $(MAKEFILE_LIST)
|
|
|
|
install: ## Install dependencies
|
|
@echo "Installing dependencies..."
|
|
@bun install
|
|
|
|
clean: ## Clean build artifacts and dependencies
|
|
@echo "Cleaning up..."
|
|
@rm -rf node_modules dist build .cache
|
|
|
|
##@ Development
|
|
|
|
dev: ## Start development server
|
|
@echo "Starting development server..."
|
|
@bun run dev
|
|
|
|
build: ## Build the application
|
|
@echo "Building application..."
|
|
@bun run build
|
|
|
|
##@ Testing
|
|
|
|
test: ## Run unit tests
|
|
@echo "Running unit tests..."
|
|
@bun run test
|
|
|
|
test-watch: ## Run unit tests in watch mode
|
|
@echo "Running tests in watch mode..."
|
|
@bun run test:watch
|
|
|
|
##@ Docker
|
|
|
|
docker-build: ## Build Docker image for multiple architectures
|
|
@echo "Building multi-platform Docker image..."
|
|
@docker buildx build --platform linux/amd64,linux/arm64 \
|
|
--build-arg NODE_ENV=production \
|
|
-t meds-app:latest .
|
|
|
|
docker-build-local: ## Build Docker image for local platform only
|
|
@echo "Building local Docker image..."
|
|
@docker buildx build --platform linux/amd64 \
|
|
--build-arg NODE_ENV=production \
|
|
-t meds-app:latest --load .
|
|
|
|
docker-clean: ## Clean Docker resources
|
|
@echo "Cleaning Docker resources..."
|
|
@docker image prune -f --filter "until=24h" 2>/dev/null || true
|
|
@docker volume prune -f 2>/dev/null || true
|