-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
64 lines (62 loc) · 2.08 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
help:
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
compose = docker-compose -p pictyschool
exec = ${compose} exec
run = ${compose} run
logs = ${compose} logs -f --tail 200
install: ## Install API and client
cp api/ormconfig.json.dist api/ormconfig.json
if [ ! -f 'api/.env' ]; then cp api/.env.dist api/.env; fi;
if [ ! -f 'client/config.js' ]; then cp client/config.js.dist client/config.js; fi;
docker run -it --rm -v ${PWD}/api:/app -w /app node npm i
docker run -it --rm -v ${PWD}/client:/app -w /app node npm i
make start-container
make api-build-dist
make database-migrate
make watch-tailwind
stop: ## Stop docker containers
${compose} stop
rm: ## Remove docker containers
${compose} rm
ps: ## List docker containers
${compose} ps
start: ## Start the application
make start-container
make watch-tailwind
restart: ## Restart containers
make stop
make start
start-container: ## Start docker containers
${compose} up -d
watch-tailwind:
${exec} client npm run watch:tailwind
build-tailwind: ## Build Tailwind in production mode
${exec} client npm run build:tailwind
test: ## Run test suite
${exec} api npm run test
test-watch: ## Run test suite
${exec} api npm run test:watch
linter: ## Linter
${exec} api npm run lint
${exec} client npm run lint
api-logs: ## Display API logs
${logs} api
api-bash: ## Connect to API container
${exec} api bash
api-build-dist: ## Build API dist
${exec} api npm run build
client-logs: ## Display Client logs
${logs} client
client-bash: ## Connect to client container
${exec} client bash
database-migrate: ## Database migrations
${exec} api npm run migration:migrate
database-diff: ## Generate database diff. Usage: make database-diff MIGRATION_NAME=MyMigration
${exec} api npm run migration:diff $(MIGRATION_NAME)
database-show-mig: ## Show migrations
${exec} api npm run migration:show
database-connect: ## Connect to the database container
${exec} database psql -h database -d pictyschool
ci: ## Run CI checks
${run} api npm run test:cov
${run} api npm run lint