-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
113 lines (84 loc) · 2.73 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
112
113
PACKAGE = nest
TESTS = tests
BASE = $(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))
POETRY = poetry
NPM = npm
V = 0
Q = $(if $(filter 1,$V),,@)
M = $(shell printf "\033[34;1m▶\033[0m")
$(POETRY): ; $(info $(M) checking poetry...)
$Q
$(NPM): ; $(info $(M) checking npm...)
$(BASE): | $(POETRY) $(YARN) ; $(info $(M) checking project...)
$Q
###################
# Running servers #
###################
.PHONY: start
start: ; $(info $(M) Starting services through mprocs...) @
$Q cd $(BASE) && mprocs
###########
# Schemas #
###########
.PHONY: schema
schema: schema-backend schema-frontend | $(BASE) ; @
$Q
.PHONY: schema-backend
schema-backend: ; $(info $(M) Exporting backend schema...) @
$Q cd $(BASE) && $(POETRY) run python manage.py export_schema --output "$(BASE)/schema.json"
.PHONY: schema-frontend
schema-frontend: ; $(info $(M) Generating frontend types from schema...) @
$Q cd $(BASE) && $(NPM) run openapi:generate
###########
# Linting #
###########
# Linters
.PHONY: lint
lint: lint-backend lint-frontend | $(BASE) ; @
$Q
.PHONY: lint-backend
lint-backend: lint-mypy lint-ruff lint-ruff-format | $(BASE) ; @
$Q
.PHONY: lint-frontend
lint-frontend: lint-tsc lint-eslint lint-prettier | $(BASE) ; @
$Q
.PHONY: lint-ruff
lint-ruff: ; $(info $(M) running ruff lint...) @
$Q cd $(BASE) && $(POETRY) run ruff $(PACKAGE) $(TESTS)
.PHONY: lint-ruff-format
lint-ruff-format: ; $(info $(M) running ruff format...) @
$Q cd $(BASE) && $(POETRY) run ruff format $(PACKAGE) $(TESTS) --diff
.PHONY: lint-mypy
lint-mypy: ; $(info $(M) running mypy...) @
$Q cd $(BASE) && $(POETRY) run mypy --show-error-code --show-column-numbers $(PACKAGE)
.PHONY: lint-eslint
lint-eslint: ; $(info $(M) running eslint...) @
$Q cd $(BASE) && $(NPM) run eslint:check
.PHONY: lint-prettier
lint-prettier: ; $(info $(M) running prettier...) @
$Q cd $(BASE) && $(NPM) run prettier:check
.PHONY: lint-tsc
lint-tsc: ; $(info $(M) running tsc...) @
$Q cd $(BASE) && $(NPM) run tsc:check
# Fixers
.PHONY: fix
fix: fix-backend fix-frontend | $(BASE) ; @
$Q
.PHONY: fix-backend
fix-backend: fix-ruff .fix-ruff-format | $(BASE) ; @
$Q
.PHONY: fix-frontend
fix-frontend: fix-eslint fix-prettier | $(BASE) ; @
$Q
.PHONY: fix-ruff
fix-ruff: ; $(info $(M) running ruff with fix...) @
$Q cd $(BASE) && $(POETRY) run ruff $(PACKAGE) $(TESTS) --fix
.PHONY: fix-ruff-format
.fix-ruff-format: ; $(info $(M) running ruff format with fix...) @
$Q cd $(BASE) && $(POETRY) run ruff format $(PACKAGE) $(TESTS)
.PHONY: fix-eslint
fix-eslint: ; $(info $(M) running eslint with fix...) @
$Q cd $(BASE) && $(NPM) run eslint:fix
.PHONY: fix-prettier
fix-prettier: ; $(info $(M) running prettier with fix...) @
$Q cd $(BASE) && $(NPM) run prettier:fix