-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathMakefile
106 lines (86 loc) · 2.39 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
SASS = ./node_modules/.bin/sass
BROWSER_SYNC = ./node_modules/.bin/browser-sync
ESBUILD = node bundle.mjs
TS_LINT = ./node_modules/.bin/tslint
TAPE = ./node_modules/tape/bin/tape
FAUCET = ./node_modules/.bin/faucet
TAP_DOT = ./node_modules/.bin/tap-dot
NYC = ./node_modules/.bin/nyc
CODECOV = ./node_modules/.bin/codecov
SANE = ./node_modules/.bin/sane
CONCURRENTLY = ./node_modules/.bin/concurrently
TS_ENTRY_POINT := ts/main.ts
BUNDLE_TARGET := public/assets/javascript/party.js
TS_SOURCES := ts/**.ts ts/**.tsx
TS_TEST_SOURCES := 'ts/test/**/*.spec.ts'
TS_TEST_SOURCES_DIR := ts/test
all: build
bootstrap: node_modules
.PHONY: bootstrap
node_modules:
@npm install
build: bootstrap css js
.PHONY: build
build-dev: bootstrap css js-dev
.PHONY: build-dev
css:
@mkdir -p ./public/assets/stylesheets
@${SASS} ./scss/party.scss --style=compressed > ./public/assets/stylesheets/party.min.css
.PHONY: css
js:
@echo "Building chances-party browser client..."
@echo "Entry point: ${TS_ENTRY_POINT}"
@echo "Bundle target: ${BUNDLE_TARGET}"
@${ESBUILD}
.PHONY: js
js-dev:
@echo "Building chances-party browser client..."
@echo "Entry point: ${TS_ENTRY_POINT}"
@echo "Bundle target: ${BUNDLE_TARGET}"
@NODE_ENV=development ${ESBUILD}
.PHONY: js-dev
lint:
@${TS_LINT} -c tslint.json ${TS_SOURCES}
.PHONY: lint
test: lint
@npm run test:ts --silent
.PHONY: test
cover:
@rm -rf coverage
@npx tsc
@${NYC} ${TAPE} ${TS_TEST_SOURCES} | ${FAUCET}
@xdg-open coverage/index.html 2> /dev/null || open coverage/index.html
.PHONY: cover
test-ci: lint
@rm -rf coverage
@npx tsc
@${NYC} ${TAPE} ${TS_TEST_SOURCES} | ${TAP_DOT}
@${CODECOV} -f coverage/*.json -t 3a8a22dc-d6c4-4c57-b7e8-edfa34ea9b85
.PHONY: test-ci
watch:
@echo "Entry point: ${TS_ENTRY_POINT}"
@echo "Bundle target: ${BUNDLE_TARGET}"
@make --quiet clean
@${CONCURRENTLY} -n "js,sass,sync" -c "red,magenta,gray" --group --kill-others \
"make --quiet watch-js" \
"make --quiet watch-scss" \
"make --quiet browser-sync"
.PHONY: watch
browser-sync:
@${BROWSER_SYNC} start -s public -f public --open ui
.PHONY: browser-sync
watch-scss:
@${SANE} "make --quiet css" scss --wait=2
.PHONY: watch-scss
watch-js:
@NODE_ENV=development WATCH='' ${ESBUILD}
.PHONY: watch-js
watch-tests:
@make test
@fswatch -or --latency=2 ${TS_TEST_SOURCES_DIR} | xargs -n1 -I {} \
make test
.PHONY: watch-tests
clean:
rm -f public/index.html
rm -f ${BUNDLE_TARGET}
.PHONY: clean