-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
85 lines (70 loc) · 2.14 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
PLATFORM := $(shell node -e "process.stdout.write(process.platform)")
ifeq ($(PLATFORM), win32)
SHELL = cmd
endif
NPM := npm
ifeq ($(shell pnpm --version >/dev/null 2>&1 && echo true || echo false), true)
NPM = pnpm
else
ifeq ($(shell yarn --version >/dev/null 2>&1 && echo true || echo false), true)
NPM = yarn
endif
endif
.EXPORT_ALL_VARIABLES:
.PHONY: all
all: build
.PHONY: install
install: node_modules
node_modules: package.json
@$(NPM) install
.PHONY: prepare
prepare:
@sh prepare.sh
.PHONY: format
format: install
-@eslint --fix --ext .ts,.tsx . 2>/dev/null || true
@prettier --write ./**/*.{json,md,scss,yaml,yml,js,jsx,ts,tsx} --ignore-path .gitignore
@mkdir -p node_modules/.make && touch -m node_modules/.make/format
node_modules/.make/format: $(shell git ls-files | grep -P "\.(j|t)sx?$$")
@$(MAKE) -s format
.PHONY: spellcheck
spellcheck: node_modules/.make/format
-@cspell --config .cspellrc src/**/*.ts
@mkdir -p node_modules/.make && touch -m node_modules/.make/spellcheck
node_modules/.make/spellcheck: $(shell git ls-files | grep -P "\.(j|t)sx?$$")
-@$(MAKE) -s spellcheck
.PHONY: lint
lint: node_modules/.make/spellcheck
-@tsc --outDir node_modules/.tmp/dist
-@eslint --ext .ts,.tsx .
@eslint -f json -o node_modules/.tmp/eslintReport.json --ext .ts,.tsx ./
node_modules/.tmp/eslintReport.json: $(shell git ls-files | grep -P "\.(j|t)sx?$$")
-@$(MAKE) -s lint
.PHONY: test
test: node_modules/.tmp/eslintReport.json
@jest --coverage --coverageDirectory node_modules/.tmp/coverage
node_modules/.tmp/coverage/lcov.info: $(shell git ls-files | grep -P "\.(j|t)sx?$$")
-@$(MAKE) -s test
.PHONY: clean
clean:
-@jest --clearCache
@git clean -fXd -e \!/node_modules -e \!/node_modules/**/* -e \!/yarn.lock -e \!/pnpm-lock.yaml -e \!/package-lock.json
-@rm -rf node_modules/.cache || true
-@rm -rf node_modules/.make || true
-@rm -rf node_modules/.tmp || true
.PHONY: build
build: dist
dist: node_modules/.tmp/coverage/lcov.info $(shell git ls-files)
-@rm -rf dist 2>/dev/null || true
@nest build
.PHONY: start
start:
@nest start --watch
.PHONY: purge
purge: clean
@git clean -fXd
.PHONY: report
report: spellcheck lint test
@
%:
@