summaryrefslogtreecommitdiffstats
path: root/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile39
1 files changed, 39 insertions, 0 deletions
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..3545904
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,39 @@
+BUN ?= bun
+
+.DEFAULT_GOAL := help
+.PHONY: help install test lint format build check clean
+
+help:
+ @echo 'Targets:'
+ @echo ' install install the development dependencies'
+ @echo ' test run the browser test suite (bun test + Chromium)'
+ @echo ' lint prettier --check + a bundle syntax check (read-only)'
+ @echo ' format apply prettier (writes)'
+ @echo ' build bundle to dist/ and report the gzipped size'
+ @echo ' check lint + test + build, in that order'
+ @echo ' clean remove build artefacts'
+
+node_modules: package.json
+ $(BUN) install
+ @touch node_modules
+
+install: node_modules
+
+test: node_modules
+ $(BUN) test
+
+lint: node_modules
+ $(BUN) x prettier --check .
+ $(BUN) build ./src/global.js --target browser --format iife > /dev/null
+
+format: node_modules
+ $(BUN) x prettier --write .
+
+build: node_modules
+ rm -rf dist
+ $(BUN) run build
+
+check: lint test build
+
+clean:
+ rm -rf dist