create-win-project 1.4.0 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +1 -1
- package/README.md +54 -147
- package/checks/check-compatibility.js +37 -8
- package/checks/check-generated-project.js +27 -3
- package/checks/check-library.js +13 -3
- package/checks/check-package.js +15 -0
- package/checks/classify-changes.js +5 -15
- package/checks/run-compatibility-shard.js +21 -0
- package/docs/README.md +20 -0
- package/docs/capabilities.md +13 -0
- package/docs/compatibility.md +13 -0
- package/docs/generated-project.md +12 -0
- package/docs/getting-started.md +26 -0
- package/docs/{ARCHITECTURE.md → maintainers/architecture.md} +3 -3
- package/docs/maintainers/ci-strategy.md +46 -0
- package/docs/{CONTRIBUTING.md → maintainers/contributing.md} +7 -7
- package/docs/migration-v2.md +13 -0
- package/docs/production-contract.md +24 -0
- package/library/INDEX.md +1 -1
- package/library/compatibility-impact.json +14 -0
- package/library/development-tools/devops/makefile/commands.md +11 -0
- package/library/development-tools/devops/makefile/definition.json +2 -2
- package/library/development-tools/devops/makefile/docker.md +9 -0
- package/library/development-tools/devops/makefile/validation.md +5 -0
- package/library/features/sqlalchemy-alembic.md +17 -0
- package/library/optional-features/concerns/zod/errors.md +5 -0
- package/library/optional-features/concerns/zod/testing.md +5 -0
- package/library/optional-features/concerns/zod/validation.md +21 -0
- package/library/optional-features/styling/css-modules/definition.json +3 -2
- package/library/optional-features/styling/css-modules/responsive.md +5 -0
- package/library/optional-features/styling/css-modules/theme.md +7 -0
- package/library/stacks/expo/definition.json +2 -2
- package/library/stacks/fastapi/architecture.md +40 -0
- package/library/stacks/fastapi/definition.json +39 -0
- package/library/stacks/fastapi/runtime.md +25 -0
- package/library/stacks/fastapi/security.md +26 -0
- package/library/stacks/fastapi/structure.md +27 -0
- package/library/stacks/fastapi/testing.md +23 -0
- package/library/stacks/nextjs/definition.json +2 -2
- package/library/stacks/no-frontend/definition.json +1 -1
- package/library/stacks/react-vite/definition.json +2 -2
- package/library/tested-versions.json +42 -2
- package/library/universal/coding-rules/definition.json +3 -3
- package/library/universal/coding-rules/hygiene.md +9 -0
- package/library/universal/coding-rules/naming.md +17 -0
- package/library/universal/git-conventions/branches.md +5 -0
- package/library/universal/git-conventions/commits.md +7 -0
- package/library/universal/git-conventions/definition.json +4 -2
- package/library/universal/git-conventions/workflow.md +5 -0
- package/library/universal/typescript/boundaries.md +13 -0
- package/library/universal/typescript/definition.json +3 -3
- package/library/universal/typescript/errors.md +5 -0
- package/library/universal/typescript/patterns.md +7 -0
- package/package.json +4 -6
- package/src/cli/arguments.js +11 -0
- package/src/cli/main.js +18 -0
- package/src/cli/questions.js +16 -15
- package/src/cli/system-check.js +22 -2
- package/src/engine/load-library.js +3 -2
- package/src/engine/project-files.js +10 -1
- package/src/engine/project-guidance.js +2 -1
- package/src/engine/project-shapes.js +4 -4
- package/src/engine/render-templates.js +3 -0
- package/src/engine/tested-versions.js +21 -2
- package/src/engine/upgrade-report.js +20 -0
- package/src/stacks/available-stacks.js +2 -0
- package/src/stacks/backends/fastapi/ci.js +3 -0
- package/src/stacks/backends/fastapi/create-files.js +874 -0
- package/src/stacks/backends/fastapi/docker.js +75 -0
- package/src/stacks/backends/fastapi/environment.js +3 -0
- package/src/stacks/backends/fastapi/index.js +32 -0
- package/src/stacks/compose-files.js +19 -1
- package/src/stacks/create-project.js +128 -7
- package/src/stacks/frontends/nextjs/index.js +1 -1
- package/src/stacks/frontends/react-native/create-files.js +4 -1
- package/src/stacks/frontends/react-native/environment.js +1 -1
- package/src/stacks/frontends/react-native/index.js +1 -1
- package/src/stacks/frontends/react-vite/environment.js +1 -1
- package/src/stacks/frontends/react-vite/index.js +1 -1
- package/src/stacks/shared/capability-packs.js +31 -0
- package/src/stacks/shared/environment.js +12 -4
- package/src/stacks/shared/javascript-package.js +6 -0
- package/templates/ci/fastapi.yml +62 -0
- package/templates/docker/compose-prod/fastapi.yml +52 -0
- package/templates/docker/compose-prod/springboot.yml +19 -1
- package/templates/docker/dockerfile/fastapi.dev.dockerfile +9 -0
- package/templates/docker/dockerfile/fastapi.prod.dockerfile +11 -0
- package/templates/docker/dockerfile/nextjs.prod.dockerfile +1 -0
- package/templates/docker/dockerfile/springboot.prod.dockerfile +4 -1
- package/templates/docker/dockerfile/vite.prod.dockerfile +2 -1
- package/templates/makefile/fastapi.mk +97 -0
- package/library/development-tools/devops/makefile/makefile.md +0 -556
- package/library/optional-features/concerns/zod.md +0 -174
- package/library/optional-features/styling/css-modules/css-modules-extensions.md +0 -267
- package/library/universal/coding-rules/coding-rules.md +0 -281
- package/library/universal/git-conventions/git-conventions.md +0 -186
- package/library/universal/typescript/typescript.md +0 -272
- /package/docs/{CONTENT_MODEL.md → maintainers/content-model.md} +0 -0
- /package/docs/{DEPENDENCY_MAINTENANCE.md → maintainers/dependencies.md} +0 -0
|
@@ -1,556 +0,0 @@
|
|
|
1
|
-
# DevOps: Makefile
|
|
2
|
-
|
|
3
|
-
---
|
|
4
|
-
|
|
5
|
-
## Core Rules
|
|
6
|
-
- All targets declared in `.PHONY` — no exceptions
|
|
7
|
-
- Always include a `help` target as default
|
|
8
|
-
- Variables declared at top of file
|
|
9
|
-
- One logical action per target
|
|
10
|
-
- Targets that chain: call other make targets, not duplicated raw commands
|
|
11
|
-
- Use variables for repeated tools/commands (`$(COMPOSE)`, `$(SUPABASE)`, `$(NPM)`, etc.)
|
|
12
|
-
- Local development commands must stay local regardless of Git branch
|
|
13
|
-
- Never infer production behavior from `git branch --show-current`
|
|
14
|
-
- Destructive database commands must explicitly target the intended environment
|
|
15
|
-
- `db-reset` means local development reset unless a project manifest explicitly defines otherwise
|
|
16
|
-
- Never create a normal Make target that resets the production database
|
|
17
|
-
- Production deployment/database mutation should be handled by explicit release/CI workflows where possible
|
|
18
|
-
- Help text must clearly label destructive commands and environment scope
|
|
19
|
-
|
|
20
|
-
---
|
|
21
|
-
|
|
22
|
-
## Environment Rule
|
|
23
|
-
|
|
24
|
-
Git workflow and runtime environment are separate concerns.
|
|
25
|
-
|
|
26
|
-
```text
|
|
27
|
-
Git flow:
|
|
28
|
-
feature/* / fix/*
|
|
29
|
-
↓
|
|
30
|
-
dev
|
|
31
|
-
↓
|
|
32
|
-
main
|
|
33
|
-
↓
|
|
34
|
-
release tag
|
|
35
|
-
```
|
|
36
|
-
|
|
37
|
-
Local commands must behave the same on every branch:
|
|
38
|
-
|
|
39
|
-
```text
|
|
40
|
-
feature/* + make dev → LOCAL environment
|
|
41
|
-
dev + make dev → LOCAL environment
|
|
42
|
-
main + make dev → LOCAL environment
|
|
43
|
-
```
|
|
44
|
-
|
|
45
|
-
Do NOT implement logic like:
|
|
46
|
-
|
|
47
|
-
```makefile
|
|
48
|
-
# BAD — branch silently changes environment
|
|
49
|
-
ifeq ($(shell git branch --show-current),main)
|
|
50
|
-
ENV := production
|
|
51
|
-
endif
|
|
52
|
-
```
|
|
53
|
-
|
|
54
|
-
Production credentials and production deployment belong to the deployment/release environment, not to branch-sensitive local Make commands.
|
|
55
|
-
|
|
56
|
-
---
|
|
57
|
-
|
|
58
|
-
## Full Makefile Template (React + Spring Boot)
|
|
59
|
-
|
|
60
|
-
```makefile
|
|
61
|
-
# =============================================================================
|
|
62
|
-
# Makefile — {{PROJECT_NAME}}
|
|
63
|
-
# =============================================================================
|
|
64
|
-
|
|
65
|
-
# Variables
|
|
66
|
-
COMPOSE := docker compose
|
|
67
|
-
COMPOSE_PROD := docker compose -f docker-compose.prod.yml
|
|
68
|
-
FRONTEND := $(COMPOSE) exec frontend
|
|
69
|
-
BACKEND := $(COMPOSE) exec backend
|
|
70
|
-
DB := $(COMPOSE) exec db
|
|
71
|
-
|
|
72
|
-
# =============================================================================
|
|
73
|
-
# Default
|
|
74
|
-
# =============================================================================
|
|
75
|
-
|
|
76
|
-
.DEFAULT_GOAL := help
|
|
77
|
-
|
|
78
|
-
.PHONY: help
|
|
79
|
-
help: ## Show all available commands
|
|
80
|
-
@grep -E '^[a-zA-Z0-9_-]+:.*?## .*$$' $(MAKEFILE_LIST) \
|
|
81
|
-
| awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-24s\033[0m %s\n", $$1, $$2}'
|
|
82
|
-
|
|
83
|
-
# =============================================================================
|
|
84
|
-
# Project Lifecycle — LOCAL
|
|
85
|
-
# =============================================================================
|
|
86
|
-
|
|
87
|
-
.PHONY: dev up down restart logs logs-front logs-back clean
|
|
88
|
-
|
|
89
|
-
dev: ## LOCAL: Start all containers and follow logs
|
|
90
|
-
$(COMPOSE) up --build
|
|
91
|
-
|
|
92
|
-
up: ## LOCAL: Start all containers in background
|
|
93
|
-
$(COMPOSE) up -d --build
|
|
94
|
-
|
|
95
|
-
down: ## LOCAL: Stop and remove local containers
|
|
96
|
-
$(COMPOSE) down
|
|
97
|
-
|
|
98
|
-
restart: down up ## LOCAL: Stop then start all containers
|
|
99
|
-
|
|
100
|
-
logs: ## LOCAL: Follow logs from all containers
|
|
101
|
-
$(COMPOSE) logs -f
|
|
102
|
-
|
|
103
|
-
logs-front: ## LOCAL: Follow frontend logs only
|
|
104
|
-
$(COMPOSE) logs -f frontend
|
|
105
|
-
|
|
106
|
-
logs-back: ## LOCAL: Follow backend logs only
|
|
107
|
-
$(COMPOSE) logs -f backend
|
|
108
|
-
|
|
109
|
-
clean: ## LOCAL DESTRUCTIVE: Remove containers, volumes, and orphans
|
|
110
|
-
$(COMPOSE) down -v --remove-orphans
|
|
111
|
-
|
|
112
|
-
# =============================================================================
|
|
113
|
-
# Individual Services — LOCAL
|
|
114
|
-
# =============================================================================
|
|
115
|
-
|
|
116
|
-
.PHONY: dev-front dev-back
|
|
117
|
-
|
|
118
|
-
dev-front: ## LOCAL: Start frontend container only
|
|
119
|
-
$(COMPOSE) up frontend --build
|
|
120
|
-
|
|
121
|
-
dev-back: ## LOCAL: Start backend + DB containers only
|
|
122
|
-
$(COMPOSE) up backend db --build
|
|
123
|
-
|
|
124
|
-
# =============================================================================
|
|
125
|
-
# Database — LOCAL
|
|
126
|
-
# =============================================================================
|
|
127
|
-
|
|
128
|
-
.PHONY: migrate seed db-reset db-shell
|
|
129
|
-
|
|
130
|
-
migrate: ## LOCAL: Run pending Flyway migrations
|
|
131
|
-
$(BACKEND) ./mvnw flyway:migrate
|
|
132
|
-
|
|
133
|
-
seed: ## LOCAL: Seed database with development data
|
|
134
|
-
$(DB) psql -U $${POSTGRES_USER} -d $${POSTGRES_DB} -f /docker-entrypoint-initdb.d/seed.sql
|
|
135
|
-
|
|
136
|
-
db-reset: ## LOCAL DESTRUCTIVE: Drop + migrate + seed local DB
|
|
137
|
-
$(BACKEND) ./mvnw flyway:clean flyway:migrate
|
|
138
|
-
$(MAKE) seed
|
|
139
|
-
|
|
140
|
-
db-shell: ## LOCAL: Open psql shell inside local DB container
|
|
141
|
-
$(DB) psql -U $${POSTGRES_USER} -d $${POSTGRES_DB}
|
|
142
|
-
|
|
143
|
-
# =============================================================================
|
|
144
|
-
# Shells — LOCAL
|
|
145
|
-
# =============================================================================
|
|
146
|
-
|
|
147
|
-
.PHONY: shell-front shell-back
|
|
148
|
-
|
|
149
|
-
shell-front: ## LOCAL: Open shell inside frontend container
|
|
150
|
-
$(FRONTEND) sh
|
|
151
|
-
|
|
152
|
-
shell-back: ## LOCAL: Open shell inside backend container
|
|
153
|
-
$(BACKEND) sh
|
|
154
|
-
|
|
155
|
-
# =============================================================================
|
|
156
|
-
# Quality
|
|
157
|
-
# =============================================================================
|
|
158
|
-
|
|
159
|
-
.PHONY: lint test test-front test-back
|
|
160
|
-
|
|
161
|
-
lint: ## Run ESLint on frontend
|
|
162
|
-
$(FRONTEND) npm run lint
|
|
163
|
-
|
|
164
|
-
test: test-front test-back ## Run all tests
|
|
165
|
-
|
|
166
|
-
test-front: ## Run Vitest frontend tests
|
|
167
|
-
$(FRONTEND) npm run test
|
|
168
|
-
|
|
169
|
-
test-back: ## Run JUnit backend tests
|
|
170
|
-
$(BACKEND) ./mvnw test
|
|
171
|
-
|
|
172
|
-
# =============================================================================
|
|
173
|
-
# Production Runtime
|
|
174
|
-
# =============================================================================
|
|
175
|
-
|
|
176
|
-
.PHONY: build prod-up prod-down
|
|
177
|
-
|
|
178
|
-
build: ## Build production Docker images
|
|
179
|
-
$(COMPOSE_PROD) build
|
|
180
|
-
|
|
181
|
-
prod-up: ## PRODUCTION: Start production containers
|
|
182
|
-
$(COMPOSE_PROD) up -d
|
|
183
|
-
|
|
184
|
-
prod-down: ## PRODUCTION: Stop production containers
|
|
185
|
-
$(COMPOSE_PROD) down
|
|
186
|
-
|
|
187
|
-
# NOTE:
|
|
188
|
-
# Do not add prod-db-reset / db-reset-prod targets.
|
|
189
|
-
# Production database schema changes should use the project's migration/release flow.
|
|
190
|
-
|
|
191
|
-
# =============================================================================
|
|
192
|
-
# Scaffolding
|
|
193
|
-
# =============================================================================
|
|
194
|
-
|
|
195
|
-
.PHONY: init
|
|
196
|
-
|
|
197
|
-
init: ## Scaffold project folder structure (run once after cloning)
|
|
198
|
-
@echo "Scaffolding project structure..."
|
|
199
|
-
@mkdir -p frontend/src/{app,pages,components/{ui,shared,layout,forms},features,stores,lib,hooks,types,constants}
|
|
200
|
-
@mkdir -p frontend/e2e
|
|
201
|
-
@mkdir -p frontend/public
|
|
202
|
-
@mkdir -p backend/src/main/java/com/app/{auth/{dto,entity},config,common/{exception,response,jwt,audit}}
|
|
203
|
-
@mkdir -p backend/src/main/resources/db/{migration,dev}
|
|
204
|
-
@mkdir -p backend/src/test/java/com/app
|
|
205
|
-
@mkdir -p docs
|
|
206
|
-
@echo "Done. Run: make dev"
|
|
207
|
-
```
|
|
208
|
-
|
|
209
|
-
---
|
|
210
|
-
|
|
211
|
-
## Simplified Makefile (Next.js + Supabase — Local + Production, No Staging)
|
|
212
|
-
|
|
213
|
-
This template intentionally keeps normal Makefile database operations local.
|
|
214
|
-
|
|
215
|
-
Production credentials and production migration execution belong to the deployment/release workflow.
|
|
216
|
-
|
|
217
|
-
```makefile
|
|
218
|
-
# =============================================================================
|
|
219
|
-
# Makefile — {{PROJECT_NAME}} (Next.js + Supabase)
|
|
220
|
-
# =============================================================================
|
|
221
|
-
|
|
222
|
-
SHELL := /bin/bash
|
|
223
|
-
|
|
224
|
-
# Variables
|
|
225
|
-
SUPABASE := npm exec -- supabase
|
|
226
|
-
NPM := npm
|
|
227
|
-
|
|
228
|
-
# =============================================================================
|
|
229
|
-
# Default
|
|
230
|
-
# =============================================================================
|
|
231
|
-
|
|
232
|
-
.DEFAULT_GOAL := help
|
|
233
|
-
|
|
234
|
-
.PHONY: help
|
|
235
|
-
help: ## Show all available commands
|
|
236
|
-
@grep -E '^[a-zA-Z0-9_-]+:.*?## .*$$' $(MAKEFILE_LIST) \
|
|
237
|
-
| awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-24s\033[0m %s\n", $$1, $$2}'
|
|
238
|
-
|
|
239
|
-
# =============================================================================
|
|
240
|
-
# Development — ALWAYS LOCAL
|
|
241
|
-
# =============================================================================
|
|
242
|
-
|
|
243
|
-
.PHONY: dev build lint test test-e2e
|
|
244
|
-
|
|
245
|
-
dev: supabase-start ## LOCAL: Start Supabase + Next.js dev server
|
|
246
|
-
$(NPM) run dev
|
|
247
|
-
|
|
248
|
-
build: ## Build Next.js application
|
|
249
|
-
$(NPM) run build
|
|
250
|
-
|
|
251
|
-
lint: ## Run ESLint
|
|
252
|
-
$(NPM) run lint
|
|
253
|
-
|
|
254
|
-
test: ## Run unit/integration tests
|
|
255
|
-
$(NPM) run test
|
|
256
|
-
|
|
257
|
-
test-e2e: ## Run Playwright E2E tests
|
|
258
|
-
$(NPM) run test:e2e
|
|
259
|
-
|
|
260
|
-
# =============================================================================
|
|
261
|
-
# Supabase Local Stack — ALWAYS LOCAL
|
|
262
|
-
# =============================================================================
|
|
263
|
-
|
|
264
|
-
.PHONY: supabase-start supabase-stop supabase-status
|
|
265
|
-
|
|
266
|
-
supabase-start: ## LOCAL: Start Supabase stack
|
|
267
|
-
$(SUPABASE) start
|
|
268
|
-
|
|
269
|
-
supabase-stop: ## LOCAL: Stop Supabase stack
|
|
270
|
-
$(SUPABASE) stop
|
|
271
|
-
|
|
272
|
-
supabase-status: ## LOCAL: Show local Supabase URLs and keys
|
|
273
|
-
$(SUPABASE) status
|
|
274
|
-
|
|
275
|
-
# =============================================================================
|
|
276
|
-
# Database — ALWAYS LOCAL
|
|
277
|
-
# =============================================================================
|
|
278
|
-
|
|
279
|
-
.PHONY: db-reset db-reset-clean db-types db-diff
|
|
280
|
-
|
|
281
|
-
db-reset: ## LOCAL DESTRUCTIVE: Reset DB, apply migrations, run seed
|
|
282
|
-
$(SUPABASE) db reset --local
|
|
283
|
-
|
|
284
|
-
db-reset-clean: ## LOCAL DESTRUCTIVE: Reset DB without seed data
|
|
285
|
-
$(SUPABASE) db reset --local --no-seed
|
|
286
|
-
|
|
287
|
-
db-types: ## LOCAL: Generate TypeScript types from local schema
|
|
288
|
-
$(SUPABASE) gen types --lang typescript --local > src/types/database.types.ts
|
|
289
|
-
|
|
290
|
-
db-diff: ## LOCAL: Generate migration from local diff: make db-diff name=add_vehicle_status
|
|
291
|
-
@if [ -z "$(name)" ]; then \
|
|
292
|
-
echo "Usage: make db-diff name=add_vehicle_status"; \
|
|
293
|
-
exit 1; \
|
|
294
|
-
fi
|
|
295
|
-
$(SUPABASE) db diff --local -f $(name)
|
|
296
|
-
|
|
297
|
-
# =============================================================================
|
|
298
|
-
# Migrations — FILE CREATION ONLY
|
|
299
|
-
# =============================================================================
|
|
300
|
-
|
|
301
|
-
.PHONY: migration
|
|
302
|
-
|
|
303
|
-
migration: ## Create migration file: make migration name=add_vehicle_status
|
|
304
|
-
@if [ -z "$(name)" ]; then \
|
|
305
|
-
echo "Usage: make migration name=add_vehicle_status"; \
|
|
306
|
-
exit 1; \
|
|
307
|
-
fi
|
|
308
|
-
$(SUPABASE) migration new $(name)
|
|
309
|
-
|
|
310
|
-
# =============================================================================
|
|
311
|
-
# Production Safety
|
|
312
|
-
# =============================================================================
|
|
313
|
-
|
|
314
|
-
# Intentionally NO targets for:
|
|
315
|
-
# db-reset-prod
|
|
316
|
-
# prod-db-reset
|
|
317
|
-
# production-reset
|
|
318
|
-
#
|
|
319
|
-
# Do not make `dev` or `db-reset` branch-dependent.
|
|
320
|
-
# `make dev` is LOCAL even when current Git branch is main.
|
|
321
|
-
# Production database migrations should run through an explicit release/CI flow.
|
|
322
|
-
```
|
|
323
|
-
|
|
324
|
-
### Supabase Command Contract
|
|
325
|
-
|
|
326
|
-
```text
|
|
327
|
-
make dev → LOCAL Supabase + local Next.js
|
|
328
|
-
make supabase-start → LOCAL only
|
|
329
|
-
make supabase-stop → LOCAL only
|
|
330
|
-
make supabase-status → LOCAL only
|
|
331
|
-
make db-reset → LOCAL only, destructive
|
|
332
|
-
make db-reset-clean → LOCAL only, destructive
|
|
333
|
-
make db-types → LOCAL schema
|
|
334
|
-
make db-diff name=... → LOCAL schema diff
|
|
335
|
-
make migration name=.. → creates migration file only
|
|
336
|
-
```
|
|
337
|
-
|
|
338
|
-
No Make target should silently switch these operations to the hosted production project.
|
|
339
|
-
|
|
340
|
-
### Production Migration Flow
|
|
341
|
-
|
|
342
|
-
Production schema deployment is intentionally not a normal local Make target.
|
|
343
|
-
|
|
344
|
-
Preferred release/CI flow:
|
|
345
|
-
|
|
346
|
-
```bash
|
|
347
|
-
# Preview pending migrations against the linked production project
|
|
348
|
-
npm exec -- supabase db push --linked --dry-run
|
|
349
|
-
|
|
350
|
-
# Apply only after review / release approval
|
|
351
|
-
npm exec -- supabase db push --linked
|
|
352
|
-
```
|
|
353
|
-
|
|
354
|
-
Forbidden against production:
|
|
355
|
-
|
|
356
|
-
```bash
|
|
357
|
-
npm exec -- supabase db reset --linked
|
|
358
|
-
```
|
|
359
|
-
|
|
360
|
-
Do not add a Make target that wraps the forbidden reset command.
|
|
361
|
-
|
|
362
|
-
---
|
|
363
|
-
|
|
364
|
-
## Simplified Makefile (Next.js + PostgreSQL/Prisma)
|
|
365
|
-
|
|
366
|
-
```makefile
|
|
367
|
-
# =============================================================================
|
|
368
|
-
# Makefile — {{PROJECT_NAME}} (Next.js + Prisma)
|
|
369
|
-
# =============================================================================
|
|
370
|
-
|
|
371
|
-
COMPOSE := docker compose
|
|
372
|
-
NPM := npm
|
|
373
|
-
PRISMA := npx prisma
|
|
374
|
-
|
|
375
|
-
.DEFAULT_GOAL := help
|
|
376
|
-
|
|
377
|
-
.PHONY: help dev build lint test db-start db-stop db-migrate db-seed db-reset db-studio init
|
|
378
|
-
|
|
379
|
-
help: ## Show all available commands
|
|
380
|
-
@grep -E '^[a-zA-Z0-9_-]+:.*?## .*$$' $(MAKEFILE_LIST) \
|
|
381
|
-
| awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-24s\033[0m %s\n", $$1, $$2}'
|
|
382
|
-
|
|
383
|
-
dev: db-start ## LOCAL: Start PostgreSQL + Next.js dev server
|
|
384
|
-
$(NPM) run dev
|
|
385
|
-
|
|
386
|
-
build: ## Build for production
|
|
387
|
-
$(NPM) run build
|
|
388
|
-
|
|
389
|
-
lint: ## Run ESLint
|
|
390
|
-
$(NPM) run lint
|
|
391
|
-
|
|
392
|
-
test: ## Run tests
|
|
393
|
-
$(NPM) run test
|
|
394
|
-
|
|
395
|
-
db-start: ## LOCAL: Start PostgreSQL container
|
|
396
|
-
$(COMPOSE) up -d db
|
|
397
|
-
|
|
398
|
-
db-stop: ## LOCAL: Stop local PostgreSQL container
|
|
399
|
-
$(COMPOSE) down
|
|
400
|
-
|
|
401
|
-
db-migrate: ## LOCAL: Run Prisma development migrations
|
|
402
|
-
$(PRISMA) migrate dev
|
|
403
|
-
|
|
404
|
-
db-seed: ## LOCAL: Seed database
|
|
405
|
-
$(PRISMA) db seed
|
|
406
|
-
|
|
407
|
-
db-reset: ## LOCAL DESTRUCTIVE: Reset + migrate + seed
|
|
408
|
-
$(PRISMA) migrate reset --force
|
|
409
|
-
|
|
410
|
-
db-studio: ## LOCAL: Open Prisma Studio
|
|
411
|
-
$(PRISMA) studio
|
|
412
|
-
|
|
413
|
-
```
|
|
414
|
-
|
|
415
|
-
Production Prisma migrations should use the deployment/release workflow (for example, `prisma migrate deploy`) rather than a destructive local reset target.
|
|
416
|
-
|
|
417
|
-
---
|
|
418
|
-
|
|
419
|
-
## Help Target Convention
|
|
420
|
-
|
|
421
|
-
Every user-facing target must include a `##` description so `make help` remains useful.
|
|
422
|
-
|
|
423
|
-
```makefile
|
|
424
|
-
.PHONY: example
|
|
425
|
-
example: ## LOCAL: Explain exactly what the command does
|
|
426
|
-
@echo "example"
|
|
427
|
-
```
|
|
428
|
-
|
|
429
|
-
Recommended prefixes in descriptions:
|
|
430
|
-
|
|
431
|
-
```text
|
|
432
|
-
LOCAL: non-destructive local command
|
|
433
|
-
LOCAL DESTRUCTIVE: destructive local command
|
|
434
|
-
PRODUCTION: explicit production runtime/release command
|
|
435
|
-
```
|
|
436
|
-
|
|
437
|
-
Never label a command as generic if it mutates an environment-specific database.
|
|
438
|
-
|
|
439
|
-
---
|
|
440
|
-
|
|
441
|
-
## Database Safety Rules
|
|
442
|
-
|
|
443
|
-
```text
|
|
444
|
-
Local database reset?
|
|
445
|
-
→ Allowed
|
|
446
|
-
→ Target must explicitly use local environment where CLI supports it
|
|
447
|
-
|
|
448
|
-
Production database reset?
|
|
449
|
-
→ Forbidden
|
|
450
|
-
→ Do not create the target
|
|
451
|
-
|
|
452
|
-
Production migration?
|
|
453
|
-
→ Use reviewed migration files
|
|
454
|
-
→ Preview first when tooling supports dry-run
|
|
455
|
-
→ Prefer release/CI execution
|
|
456
|
-
|
|
457
|
-
Seed development data?
|
|
458
|
-
→ Local only
|
|
459
|
-
→ Never automatically include development seed in production
|
|
460
|
-
```
|
|
461
|
-
|
|
462
|
-
For Supabase specifically:
|
|
463
|
-
|
|
464
|
-
```makefile
|
|
465
|
-
db-reset:
|
|
466
|
-
$(SUPABASE) db reset --local
|
|
467
|
-
```
|
|
468
|
-
|
|
469
|
-
Do not rely only on the CLI default when the command is intentionally safety-critical.
|
|
470
|
-
|
|
471
|
-
---
|
|
472
|
-
|
|
473
|
-
## Git Branch Rules
|
|
474
|
-
|
|
475
|
-
Make targets must not use branch name as an automatic environment selector.
|
|
476
|
-
|
|
477
|
-
Bad:
|
|
478
|
-
|
|
479
|
-
```text
|
|
480
|
-
main branch → production DB
|
|
481
|
-
dev branch → local DB
|
|
482
|
-
```
|
|
483
|
-
|
|
484
|
-
Good:
|
|
485
|
-
|
|
486
|
-
```text
|
|
487
|
-
any branch + local command → local environment
|
|
488
|
-
release/deployment config → production environment
|
|
489
|
-
```
|
|
490
|
-
|
|
491
|
-
A branch check may be used as an additional safety gate for an already-explicit release target, but branch detection must never silently convert a development command into a production command.
|
|
492
|
-
|
|
493
|
-
---
|
|
494
|
-
|
|
495
|
-
## Agent Rules
|
|
496
|
-
|
|
497
|
-
```text
|
|
498
|
-
New make target?
|
|
499
|
-
→ Add to .PHONY
|
|
500
|
-
→ Add ## help description
|
|
501
|
-
→ Declare environment scope in help text when relevant
|
|
502
|
-
→ Use tool variables instead of repeated hardcoded commands
|
|
503
|
-
→ Keep one logical action per target
|
|
504
|
-
|
|
505
|
-
Target chains another target?
|
|
506
|
-
→ Use $(MAKE) target-name or a prerequisite
|
|
507
|
-
→ Do not duplicate the chained target's raw commands
|
|
508
|
-
|
|
509
|
-
New Docker command?
|
|
510
|
-
→ Use $(COMPOSE) / configured compose variable
|
|
511
|
-
→ Do not hardcode docker compose repeatedly
|
|
512
|
-
|
|
513
|
-
Supabase local lifecycle?
|
|
514
|
-
→ supabase-start / supabase-stop / supabase-status
|
|
515
|
-
→ Always local
|
|
516
|
-
|
|
517
|
-
Supabase db reset?
|
|
518
|
-
→ Must explicitly use `db reset --local`
|
|
519
|
-
→ Help text must say LOCAL DESTRUCTIVE
|
|
520
|
-
→ Never use `--linked`
|
|
521
|
-
|
|
522
|
-
Supabase migration creation?
|
|
523
|
-
→ `make migration name=...`
|
|
524
|
-
→ Validate name is present
|
|
525
|
-
→ Creates migration file only
|
|
526
|
-
|
|
527
|
-
Supabase schema diff?
|
|
528
|
-
→ Explicitly use local schema
|
|
529
|
-
→ `make db-diff name=...`
|
|
530
|
-
|
|
531
|
-
Supabase type generation?
|
|
532
|
-
→ Generate from `--local` during normal development
|
|
533
|
-
|
|
534
|
-
Production Supabase migration?
|
|
535
|
-
→ Do not hide it behind normal local commands
|
|
536
|
-
→ Prefer release/CI workflow
|
|
537
|
-
→ Preview with dry-run before applying
|
|
538
|
-
→ Never reset production
|
|
539
|
-
|
|
540
|
-
Current Git branch is main?
|
|
541
|
-
→ `make dev` is still LOCAL
|
|
542
|
-
→ `make db-reset` is still LOCAL
|
|
543
|
-
→ Do not switch credentials based on branch
|
|
544
|
-
|
|
545
|
-
New service in compose?
|
|
546
|
-
→ Add logs-[service] if useful
|
|
547
|
-
→ Add shell-[service] if useful
|
|
548
|
-
|
|
549
|
-
Default goal?
|
|
550
|
-
→ Always `.DEFAULT_GOAL := help`
|
|
551
|
-
|
|
552
|
-
Init target?
|
|
553
|
-
→ Scaffold only deterministic project structure
|
|
554
|
-
→ Do not overwrite existing files
|
|
555
|
-
→ Do not create production secrets
|
|
556
|
-
```
|