aboutsummaryrefslogtreecommitdiff
path: root/makefile
diff options
context:
space:
mode:
Diffstat (limited to 'makefile')
-rw-r--r--makefile23
1 files changed, 13 insertions, 10 deletions
diff --git a/makefile b/makefile
index b2e49af..779b17c 100644
--- a/makefile
+++ b/makefile
@@ -1,8 +1,8 @@
ESFLAGS = --target=esnext --format=esm
-deploy-dir: deploy deploy/bundle.js deploy/style.css deploy/index.html deploy/fastbangs deploy/fastbangs.yaml
+deploy-dir: deploy deploy/fastbangs deploy/fastbangs.yaml
-.PHONY: watch-script watch-style clean deploy-dir
+.PHONY: watch-script watch-style clean deploy-dir build-dir
watch-script: frontend/fuzzysort.js
esbuild frontend/main.ts --bundle --outfile=deploy/bundle.js $(ESFLAGS) --watch
watch-style:
@@ -10,26 +10,29 @@ watch-style:
clean:
stack clean --full
- rm -f deploy/{bundle.js,index.html,fastbangs,style.css}
rm -f deploy.zip
rm -f frontend/fuzzysort.js
+ rm -rf build
# This leaves the deploy directory, which is intentional, as it may contain
# user data
+build-dir:
+ mkdir -p build
+build/index.html: frontend/index.html build-dir
+ cp $< $@
+build/bundle.js: $(shell find frontend -name '*.ts') frontend/fuzzysort.js build-dir
+ esbuild frontend/main.ts --bundle --outfile=build/bundle.js $(ESFLAGS)
+build/style.css: frontend/style.sass build-dir
+ sassc $< $@
+
deploy.zip: deploy-dir
zip deploy.zip -r deploy
deploy:
mkdir -p deploy
-deploy/index.html: frontend/index.html
- cp $< $@
deploy/fastbangs.yaml: fastbangs.yaml
cp --no-clobber $< $@; true
-deploy/fastbangs: $(shell find src -name '*.hs')
+deploy/fastbangs: $(shell find src -name '*.hs') build/bundle.js build/index.html build/style.css
stack install --local-bin-path deploy
-deploy/bundle.js: $(shell find frontend -name '*.ts') frontend/fuzzysort.js
- esbuild frontend/main.ts --bundle --outfile=deploy/bundle.js $(ESFLAGS)
-deploy/style.css: frontend/style.sass
- sassc $< $@
frontend/fuzzysort.js:
curl -s 'https://cdn.jsdelivr.net/npm/fuzzysort@2.0.4/fuzzysort.min.js' -o $@