-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
95 lines (76 loc) · 2.94 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
ENV_FILE = .env
ENV_EXAMPLE = .env.example
DOCKER_COMPOSE_DEV = docker-compose -f docker-compose.yaml -f docker-compose.dev.yaml
DOCKER_COMPOSE_PROD = docker-compose -f docker-compose.yaml -f docker-compose.production.yaml
DOCKER_COMPOSE_TOOLS = docker-compose -f docker-compose.tools.yaml
.PHONY: help
help:
@echo "Available make commands:"
@echo " install Install dependencies with pnpm"
@echo " set-docker-node-deps Install dependencies in a Docker container without starting the full environment"
@echo " docker-dev Run the development environment"
@echo " docker-prod Run the production environment"
@echo " migrate Run database migrations"
@echo " seed Seed the database"
@echo " rollback Rollback migrations"
@echo " serve Run the development server"
@echo " db-test Run a PostgreSQL test database container"
@echo " test Run tests in a Docker container (starts db-test, runs tests, and stops db-test)"
@echo " lint Check code format and linting in a Docker container"
@echo " lint-fix Fix code format and linting issues in a Docker container"
@echo " tsc Run TypeScript compiler checks in a Docker container"
@echo " init-dev Install dependencies, start the development environment, migrate and seed the database, and start the server"
@echo " init-prod Install dependencies, start the production environment, and migrate the database"
@echo " reset-db Rollback all migrations, run migrations, and seed the database"
@echo " offline Display instructions for enabling offline mode"
.PHONY: install
install:
pnpm install
.PHONY: set-docker-node-deps
set-docker-node-deps: docker-dev
$(DOCKER_COMPOSE_TOOLS) run --rm install-node-deps
.PHONY: docker-dev
docker-dev:
$(DOCKER_COMPOSE_DEV) up -d
.PHONY: jobs
jobs:
pnpm jobs:run
.PHONY: offline
offline:
@echo "To enable offline mode, set BYPASS_LOGIN=1 in your .env file."
.PHONY: docker-prod
docker-prod:
$(DOCKER_COMPOSE_PROD) up -d
.PHONY: migrate
migrate:
node ace migration:run
.PHONY: seed
seed:
node ace db:seed
.PHONY: rollback
rollback:
node ace migration:rollback --batch 0
.PHONE: server
serve:
pnpm dev
.PHONY: db-test
db-test:
$(DOCKER_COMPOSE_TOOLS) up -d postgres-test
.PHONY: test
test: set-docker-node-deps db-test
$(DOCKER_COMPOSE_TOOLS) run --rm test && $(DOCKER_COMPOSE_TOOLS) down postgres-test
.PHONY: lint
lint: set-docker-node-deps
$(DOCKER_COMPOSE_TOOLS) run --rm biome-check
.PHONY: lint-fix
lint-fix: set-docker-node-deps
$(DOCKER_COMPOSE_TOOLS) run --rm biome-check-fix
.PHONY: tsc
tsc:
$(DOCKER_COMPOSE_TOOLS) run --rm tsc
.PHONY: init-dev
init-dev: install docker-dev migrate seed serve
.PHONY: init-prod
init-prod: install docker-prod migrate
.PHONY: reset-db
reset-db: rollback migrate seed