From f2f2d1dec7a96e096285e7162dd09f98e9fc02b2 Mon Sep 17 00:00:00 2001 From: abhishekbhakat Date: Fri, 19 Dec 2025 17:51:36 +0530 Subject: [PATCH] feat: Enhance Makefile with frontend commands, database seeding, and improved `serve` and `clean` targets. --- Makefile | 40 ++++++++++++++++++++++++---------------- 1 file changed, 24 insertions(+), 16 deletions(-) diff --git a/Makefile b/Makefile index 2f275a9..f4751b0 100644 --- a/Makefile +++ b/Makefile @@ -1,29 +1,32 @@ # zhealth Makefile # Run `make help` to see available commands -.PHONY: help dev build release lint typecheck test clean serve +.PHONY: help build release lint typecheck test clean serve # Default target help: @echo "Available commands:" - @echo " make dev - Start development servers" + @echo " make serve - Start both backend and frontend servers" @echo " make build - Build for development" @echo " make release - Build optimized production bundle" @echo " make migrate - Run database migrations" + @echo " make seed - Seed database with initial data" @echo " make lint - Run linters (Clippy + ESLint)" @echo " make typecheck - Type checking (Rust + TypeScript)" @echo " make test - Run all tests" - @echo " make serve - Serve production build locally" @echo " make clean - Clean build artifacts" # Backend commands -.PHONY: backend-dev backend-build backend-release backend-lint backend-test migrate +.PHONY: backend-dev backend-build backend-release backend-lint backend-test migrate seed migrate: - cd backend && ./target/debug/zhealth migrate + cd backend && cargo run -- migrate + +seed: + cd backend && cargo run -- seed backend-dev: - cd backend && ./target/debug/zhealth serve + cd backend && cargo run -- serve backend-build: cd backend && cargo build @@ -37,26 +40,28 @@ backend-lint: backend-test: cd backend && cargo test -# Frontend commands (placeholder for when frontend is set up) -.PHONY: frontend-dev frontend-build frontend-release frontend-lint frontend-test +# Frontend commands +.PHONY: frontend-dev frontend-build frontend-release frontend-lint frontend-test frontend-install + +frontend-install: + cd frontend && npm install frontend-dev: - @echo "Frontend not yet configured" + cd frontend && npm run dev frontend-build: - @echo "Frontend not yet configured" + cd frontend && npm run build frontend-release: - @echo "Frontend not yet configured" + cd frontend && npm run build frontend-lint: - @echo "Frontend not yet configured" + cd frontend && npm run lint frontend-test: - @echo "Frontend not yet configured" + @echo "Frontend tests not yet configured" # Combined commands -dev: backend-dev build: backend-build frontend-build @@ -69,8 +74,11 @@ typecheck: backend-lint frontend-lint test: backend-test frontend-test serve: - cd backend && cargo run --release + @echo "Starting backend (port 3000) and frontend (port 5173)..." + @cd backend && cargo run -- serve & cd frontend && npm run dev clean: cd backend && cargo clean - @echo "Cleaned backend artifacts" + cd frontend && rm -rf node_modules dist + @echo "Cleaned build artifacts" +