-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
80 lines (67 loc) · 2.45 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
# Backend commands.
CMD:=poetry run
backend:=cd backend
ts-client:=cd clients/typescript
get-poetry:
curl -sSL https://install.python-poetry.org | python3 -
migrate:
$(backend) && $(CMD) python3 manage.py makemigrations
$(backend) && $(CMD) python3 manage.py migrate
user:
$(backend) && $(CMD) python3 manage.py createsuperuser
# Frontend commands.
frontend:=cd frontend
# Commands works on both servers.
install:
$(backend) && poetry install
$(backend) && poetry check
$(frontend) && yarn
run:
ifeq ($(server), frontend)
$(frontend) && yarn dev
else ifeq ($(server), backend)
$(backend) && $(CMD) python3 manage.py runserver
endif
lint:
$(backend) && $(CMD) black . --exclude=__init__.py
$(backend) && $(CMD) flake8 . --exclude=__init__.py
$(ts-client) && yarn lint
# $(frontend) && yarn lint
# Run examples
# Python Example
py-switchkeys:
cd clients/python && python3 -m example
# Dart Example
dart-switchkeys:
cd clients/dart/switchkeys && dart example.dart
# Typescript Example
ts-switchkeys:
cd clients/typescript && npx ts-node ./example.ts
# Docker commands
docker-up:
ifeq ($(service), backend)
docker compose -f ./docker/docker-compose.yml --env-file=./config/.env up backend --build -d
# else ifeq ($(service), frontend) | docker compose -f ./docker/docker-compose.yml --env-file=./config/.env up frontend --build -d
else ifeq ($(service), postgres)
docker compose -f ./docker/docker-compose.yml --env-file=./config/.env up postgres --build -d
else
docker compose -f ./docker/docker-compose.yml --env-file=./config/.env up --build -d
endif
docker-down:
ifeq ($(service), backend)
docker compose -f ./docker/docker-compose.yml --env-file=./config/.env down backend
# else ifeq ($(service), frontend) | docker compose -f ./docker/docker-compose.yml --env-file=./config/.env down frontend
else ifeq ($(service), postgres)
docker compose -f ./docker/docker-compose.yml --env-file=./config/.env down postgres
else
docker compose -f ./docker/docker-compose.yml --env-file=./config/.env down
endif
docker-logs:
ifeq ($(service), backend)
docker compose -f ./docker/docker-compose.yml --env-file=./config/.env logs -f backend
# else ifeq ($(service), frontend) | docker compose -f ./docker/docker-compose.yml --env-file=./config/.env logs -f frontend
else ifeq ($(service), postgres)
docker compose -f ./docker/docker-compose.yml --env-file=./config/.env logs -f postgres
else
docker compose -f ./docker/docker-compose.yml --env-file=./config/.env logs -f
endif