-
Notifications
You must be signed in to change notification settings - Fork 6
/
Makefile
54 lines (40 loc) · 1.22 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
SRC=src
TST=test
DIST=dist
ENTRYPOINT=$(DIST)/index.js
TSC=./node_modules/.bin/tsc
TSC_WATCH=./node_modules/.bin/tsc-watch
ESLINT=./node_modules/.bin/eslint
PRETTIER=./node_modules/.bin/prettier
JEST=./node_modules/.bin/jest
TSC_FLAGS=
INSTALL_FLAGS=--frozen-lockfile
TSC_WATCH_FLAGS=$(TSC_FLAGS) --onSuccess "node $(ENTRYPOINT)"
JEST_FLAGS=--verbose \
--coverage \
--config jest.config.js \
--reporters=default \
--reporters=jest-junit
TS_SOURCES=$(wildcard $(SRC)/**/*.ts)
TEST_SOURCES=$(wildcard $(TST)/**/*.ts)
all: $(ENTRYPOINT)
$(ENTRYPOINT): $(TS_SOURCES) node_modules data.json
$(TSC) $(TSC_FLAGS)
data.json:
wget https://raw.githubusercontent.com/nexus-devs/wow-classic-items/master/data/json/data.json
node_modules: package.json pnpm-lock.yaml
pnpm install $(INSTALL_FLAGS)
lint: node_modules
$(ESLINT) $(TS_SOURCES) $(TEST_SOURCES)
$(PRETTIER) $(TS_SOURCES) $(TEST_SOURCES)
fix: node_modules
$(PRETTIER) --write $(TS_SOURCES) $(TEST_SOURCES)
$(ESLINT) --fix $(TS_SOURCES) $(TEST_SOURCES)
dev: node_modules data.json
$(TSC_WATCH) $(TSC_WATCH_FLAGS)
junit.xml: node_modules $(TS_SOURCES) $(TEST_SOURCES)
$(JEST) $(JEST_FLAGS)
test: junit.xml
clean:
git clean
.PHONY: dev lint fix test clean all