diff options
author | Hugo Hörnquist <hugo@lysator.liu.se> | 2022-08-01 00:47:02 +0200 |
---|---|---|
committer | Hugo Hörnquist <hugo@lysator.liu.se> | 2022-08-01 01:06:27 +0200 |
commit | 80126c76f39d30917b94f24b97a8690681b815c0 (patch) | |
tree | bf60d7ea2de8be12e6ba67aa7b10db01f0e689ec /static/Makefile | |
parent | Static should create its own directories when installing. (diff) | |
download | calp-80126c76f39d30917b94f24b97a8690681b815c0.tar.gz calp-80126c76f39d30917b94f24b97a8690681b815c0.tar.xz |
Change JavaScript build system to esbuild.
Esbuild is way faster, and feels less hacky. One downside is that it
doesn't actually check Typescript types. However, typescript can still
be installed alongside, and has the fancy --noEmit flag for just this
situation.
Diffstat (limited to '')
-rw-r--r-- | static/Makefile | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/static/Makefile b/static/Makefile index 0c6023b0..c348b3a8 100644 --- a/static/Makefile +++ b/static/Makefile @@ -1,22 +1,29 @@ -.PHONY: all install clean watch +.PHONY: all install clean watch watch-esbuild -TARGETS := style.css smallcal.css script.out.js directory-listing.css +TARGETS := style.css smallcal.css script.js directory-listing.css WATCH= TS_FILES = $(shell find . -type f -name \*.ts -not -path */node_modules/*) JS_FILES = $(TS_FILES:%.ts=%.js) +ESBUILD_LOGLEVEL=warning +# Variable for adding extra flags +ESBUILD_FLAGS = +# Used flags +__ESBUILD_FLAGS = --log-level=$(ESBUILD_LOGLEVEL) \ + --sourcemap --bundle --outdir=$(CURDIR) \ + $(ESBUILD_FLAGS) + export PATH := $(shell npm bin):$(PATH) all: $(TARGETS) -%.map.json: %.out.js - tail -n1 $< | tail -c+65 | base64 --decode | jq '.' > $@ - -# r!browserify --list script.ts -p tsify | xargs -L1 basename | tac # script explicitly named, since that is our entry point -script.out.js: script.ts $(TS_FILES) - browserify $< -p tsify --noImplicitAny --debug -o $@ +script.js: script.ts $(TS_FILES) + esbuild $< $(__ESBUILD_FLAGS) + +watch-esbuild: + $(MAKE) ESBUILD_FLAGS+='--watch' ESBUILD_LOGLEVEL=info -B script.js deps.svg: $(TS_FILES) madge --image $@ $^ |