-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
65 lines (46 loc) · 1.04 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
PROJECT=trip
GLOBALVAR=furkotTrip
BUILD_DIR=build
SCRIPT_NAME=$(BUILD_DIR)/furkot-$(PROJECT)
BIN=./node_modules/.bin
SRC = index.js
%.gz: %
gzip --best --stdout $< > $@
%.min.js: %.js
$(BIN)/uglifyjs $< --mangle --no-copyright --compress --output $@
all: check compile
check: lint test
lint: node_modules
$(BIN)/jshint $(SRC)
test: node_modules
node --test
compile: $(SCRIPT_NAME).js
build:
mkdir -p $@
ESBUILD_OPTS += --bundle \
--log-level=warning \
--color=false \
--tree-shaking=true \
--global-name=${GLOBALVAR} \
--target=es2019
$(SCRIPT_NAME).js: $(SRC) | node_modules build
$(BIN)/esbuild $< \
$(ESBUILD_OPTS) \
--sourcemap=linked \
--outfile=$@
$(SCRIPT_NAME).min.js: $(SRC) | node_modules build
$(BIN)/esbuild $< \
$(ESBUILD_OPTS) \
--drop:console \
--drop:debugger \
--minify \
--outfile=$@
node_modules: package.json
yarn
clean:
rm -rf $(BUILD_DIR)
distclean: clean
rm -rf node_modules
.PRECIOUS: $(SCRIPT_NAME).min.js
dist: $(SCRIPT_NAME).min.js.gz
.PHONY: all lint test compile dist clean distclean