-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
111 lines (78 loc) · 2.81 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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
.DEFAULT_GOAL:=help
COMPOSE=docker compose
EXECSVELTEKIT=$(COMPOSE) exec svelte-kit
## All commands available in the Makefile
##@ Helper
help: ## Display this help
@awk 'BEGIN {FS = ":.*##"; printf "\nAll commands available in the Makefile\n \nUsage:\n make \033[36m<target>\033[0m\n"} /^[.a-zA-Z_-]+:.*?##/ { printf " \033[36m%-20s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST)
##@ Starting/stopping the project
start: up-recreate ## Build and start the project
start-nocache: ## Build and start the project without cache
build-no-chache up-recreate
up-recreate: ## Start the project and recreate the containers
$(COMPOSE) up -d --remove-orphans --force-recreate --build
up: ## Start the project
$(COMPOSE) up -d --remove-orphans
restart: ## Restart the project
$(COMPOSE) restart
stop: ## Stop the project
$(COMPOSE) stop
down: ## Stop the project and remove all containers
$(COMPOSE) down
##@ SSH
ssh: ## SSH into the container
$(EXECSVELTEKIT) bash
# Build
build-app: ## Build the app
$(EXECSVELTEKIT) bun run build
preview-app: ## Run the app in preview mode
$(EXECSVELTEKIT) bun run preview
##@ Linting
lint: ## Run the linter
$(EXECSVELTEKIT) bun run lint
format: ## Run the formatter
$(EXECSVELTEKIT) bun run format
##@ Bun
update: ## Update the project
$(EXECSVELTEKIT) bunx npm-check-updates -i
##@ Logs
logs: ## Show the logs
$(COMPOSE) logs
logs-app: ## Show the app logs
$(COMPOSE) logs -f svelte-kit
##@ Tests
test: ## Run the tests
bun run test
test-ui: ## Run the UI tests
bunx playwright test --ui
test-install: ## Install the test dependencies
bunx playwright install
##@ DB
db: ## Initialize the database
make db-reset
make db-fixtures
db-push: ## Push the current schema to the database
$(EXECSVELTEKIT) bunx drizzle-kit push:mysql --config=drizzle/drizzle.config.ts
db-reset: ## Reset the database
make db-clear
make db-migrate
db-clear: ## Pull the current schema from the database
make db-drop
make db-create
db-drop: ## Drop the database
$(EXECSVELTEKIT) bun run db:drop
db-create: ## Create the database
$(EXECSVELTEKIT) bun run db:create
db-migrate: ## Run latest migration
$(EXECSVELTEKIT) bun run db:migrate
db-fixtures: ## Load fixtures
$(EXECSVELTEKIT) bun run db:fixtures
db-drop-migration: ## Drop the latest migration from the database
$(EXECSVELTEKIT) bunx drizzle-kit drop --config=drizzle/drizzle.config.ts
db-create-migration: ## Create a new migration
$(EXECSVELTEKIT) bunx drizzle-kit generate --config=drizzle/drizzle.config.ts
##@ Utils
cmd: ## Run a command in the bun container
$(EXECSVELTEKIT) bunx dotenvx run -f .env -f .env.local --overload -- $(filter-out $@,$(MAKECMDGOALS))
bun: ## Run a bun command
$(EXECSVELTEKIT) bunx dotenvx run -f .env -f .env.local --overload -- bun $(filter-out $@,$(MAKECMDGOALS))