blob: 7bef75ef7f4fa4dc532e4c1a6fbedb4d4bfeee79 (
plain)
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
|
ESFLAGS = --target=esnext --format=esm
deploy-dir: deploy deploy/bundle.js deploy/style.css deploy/index.html deploy/fastbangs
.PHONY: watch clean deploy-dir
watch-script: frontend/fuse.js
esbuild frontend/main.ts --bundle --outfile=deploy/bundle.js $(ESFLAGS) --watch
watch-style:
while true; do inotifywait -e modify -e move frontend/style.sass; make deploy/style.css; done
clean:
stack clean --full
rm -f deploy/{bundle.js,index.html,fastbangs,style.css}
rm -f deploy.zip
# This leaves the deploy directory, which is intentional, as it may contain
# user data
deploy.zip: deploy-dir
zip deploy.zip -r deploy
deploy:
mkdir -p deploy
deploy/index.html: frontend/index.html
cp $< $@
deploy/fastbangs: $(shell find src -name '*.hs')
stack install --local-bin-path deploy
deploy/bundle.js: $(shell find frontend -name '*.ts') frontend/fuse.js
esbuild frontend/main.ts --bundle --outfile=deploy/bundle.js $(ESFLAGS)
deploy/style.css: frontend/style.sass
sassc $< $@
frontend/fuse.js:
curl 'https://cdn.jsdelivr.net/npm/fuse.js@6.6.2/dist/fuse.esm.js' -o $@
|