generated from piesku/goodluck
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
35 lines (29 loc) · 920 Bytes
/
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
SOURCES = $(shell find src -name "*.ts")
all: public/opt/game.terser.js
@printf "Size gzipped: %s bytes\n" \
$(shell gzip public/opt/index.html public/opt/game.terser.js --stdout | wc -c)
public/js/index.js: $(SOURCES)
@echo -n "Compiling project... "
@npx tsc
@echo "Done"
public/opt/game.rollup.js: public/js/index.js
@echo -n "Bundling files into one... "
@npx rollup -c bundle_config.js --silent
@echo "Done"
public/opt/game.sed.js: public/opt/game.rollup.js
@echo -n "Running replacements... "
@sed -f sed.txt $< > $@
@echo "Done"
public/opt/game.tr.js: public/opt/game.sed.js
@echo -n "Stripping newlines... "
@cat $< | tr -d "\n" > $@
@echo "Done"
public/opt/game.terser.js: public/opt/game.tr.js
@echo "Minifying... "
@npx --quiet terser $< \
--timings \
--ecma 9 \
--mangle toplevel \
--mangle-props regex=/^[A-Z]/ \
--compress $(shell paste -sd, terser_compress.txt) \
> $@