-
Notifications
You must be signed in to change notification settings - Fork 7
/
GNUmakefile
81 lines (53 loc) · 2.31 KB
/
GNUmakefile
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
.PHONY: all dist release lib clean testlib
DIRS=dist
$(shell mkdir -p $(DIRS))
download = curl --create-dirs --location -f --output $(1) $(2)
## Deps
lib: lib/incremental-dom.js lib/incremental-dom-min.js lib/incremental-dom-cjs.js
lib/incremental-dom.js:
$(call download, "$@", \
"https://unpkg.com/incremental-dom@0.7.0/dist/incremental-dom.js")
lib/incremental-dom-cjs.js:
$(call download, "$@", \
"https://unpkg.com/incremental-dom@0.7.0/dist/incremental-dom-cjs.js")
lib/incremental-dom-min.js:
$(call download, "$@", \
"https://unpkg.com/incremental-dom@0.7.0/dist/incremental-dom-min.js")
## Things needed for testing.
testlib: test/lib/qunit.js test/lib/qunit.css test/lib/qunit.css test/lib/qunit-composite.css test/lib/qunit-composite.js
test/lib/qunit.css:
$(call download, "$@", \
"https://code.jquery.com/qunit/qunit-2.5.0.css")
test/lib/qunit.js:
$(call download, "$@", \
"https://code.jquery.com/qunit/qunit-2.5.0.js")
test/lib/qunit-composite.css:
$(call download, "$@", \
"https://raw.githubusercontent.com/JamesMGreene/qunit-composite/master/qunit-composite.css")
test/lib/qunit-composite.js:
$(call download, "$@", \
"https://raw.githubusercontent.com/JamesMGreene/qunit-composite/master/qunit-composite.js")
# Dist
dist/cotonic-bundle.js: lib/incremental-dom-cjs.js $(wildcard src/*.js)
esbuild src/index-bundle.js --platform=browser --target=es2018 --bundle --outfile=dist/cotonic-bundle.js
dist/cotonic-worker-bundle.js: lib/incremental-dom-cjs.js $(wildcard src/*.js)
esbuild src/index-worker-bundle.js --platform=browser --target=es2018 --bundle --outfile=dist/cotonic-worker-bundle.js
dist/cotonic-service-worker-bundle.js:
cp src/cotonic.service-worker.js dist/cotonic-service-worker-bundle.js
dist: dist/cotonic-bundle.js dist/cotonic-worker-bundle.js dist/cotonic-service-worker-bundle.js
# Release
cotonic.js: dist/cotonic-bundle.js
cp dist/cotonic-bundle.js cotonic.js
cotonic-worker.js: dist/cotonic-worker-bundle.js
cp dist/cotonic-worker-bundle.js cotonic-worker.js
cotonic-service-worker.js: dist/cotonic-service-worker-bundle.js
cp dist/cotonic-service-worker-bundle.js cotonic-service-worker.js
release: cotonic.js cotonic-worker.js cotonic-service-worker.js
# Cleanup
clean:
rm -f dist/*
rm -f lib/*
rm -f test/lib/*
# Test
test: lib testlib
./start_dev.sh