From c0968d263d5531d21a6ff9df111d63ca2c6e43fa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hugo=20H=C3=B6rnquist?= Date: Fri, 5 Nov 2021 19:34:01 +0100 Subject: Start depending on npm. Chromium can't handle JavaScript-modules in XHTML-document [1]. The workaround is to use a javascript bundler. Here we start depending on browserify. I evaluated both that and webpack, and browserify seemed to work marginally better with typescript. Unfortunately this also makes us depend on npm, where we unfortunately already are bloatet... $ ls static/node_modules | wc -l 174 [1]: https://bugs.chromium.org/p/chromium/issues/detail?id=717643 --- static/Makefile | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'static/Makefile') diff --git a/static/Makefile b/static/Makefile index 821489bc..7a541bf6 100644 --- a/static/Makefile +++ b/static/Makefile @@ -1,10 +1,19 @@ .PHONY: all clean watch -TARGETS := style.css smallcal.css +TARGETS := style.css smallcal.css script.out.js WATCH= +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.out.js: script.ts popup.ts globals.ts vevent.ts types.ts dragable.ts clock.ts lib.ts + browserify $< -p tsify --noImplicitAny --debug -o $@ + watch: $(MAKE) WATCH=--watch all -- cgit v1.2.3 From bed4bbc560052a25e11704c6ee0b1d5cddbbc9a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hugo=20H=C3=B6rnquist?= Date: Wed, 10 Nov 2021 09:52:36 +0100 Subject: Slight frontend makefile improvements. --- static/Makefile | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'static/Makefile') diff --git a/static/Makefile b/static/Makefile index 7a541bf6..d55688ba 100644 --- a/static/Makefile +++ b/static/Makefile @@ -3,6 +3,9 @@ TARGETS := style.css smallcal.css script.out.js WATCH= +# script explicitly named, since that is our entry point +TS_FILES = script.ts $(shell find . -type f -name \*.ts -not -path */node_modules/*) + export PATH := $(shell npm bin):$(PATH) all: $(TARGETS) @@ -11,11 +14,18 @@ all: $(TARGETS) tail -n1 $< | tail -c+65 | base64 --decode | jq '.' > $@ # r!browserify --list script.ts -p tsify | xargs -L1 basename | tac -script.out.js: script.ts popup.ts globals.ts vevent.ts types.ts dragable.ts clock.ts lib.ts +script.out.js: $(TS_FILES) browserify $< -p tsify --noImplicitAny --debug -o $@ +# Note that 'tsc --watch' doesn't provide the files we are using. It's +# just here for debug. watch: - $(MAKE) WATCH=--watch all + tmux \ + new-session "scss --watch -I. style.scss:style.css" \; \ + split-window "tsc --watch" \; \ + rename-session "calp watch" \; \ + select-layout even-vertical + clean: rm $(TARGETS) -- cgit v1.2.3 From 6f4b9a70164f1be205b64e8824a83ebee717d6c7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hugo=20H=C3=B6rnquist?= Date: Wed, 10 Nov 2021 09:52:56 +0100 Subject: Add madge for frontend dep visualization. --- static/Makefile | 3 +++ 1 file changed, 3 insertions(+) (limited to 'static/Makefile') diff --git a/static/Makefile b/static/Makefile index d55688ba..b85422a3 100644 --- a/static/Makefile +++ b/static/Makefile @@ -17,6 +17,9 @@ all: $(TARGETS) script.out.js: $(TS_FILES) browserify $< -p tsify --noImplicitAny --debug -o $@ +deps.svg: $(TS_FILES) + madge --image $@ $^ + # Note that 'tsc --watch' doesn't provide the files we are using. It's # just here for debug. watch: -- cgit v1.2.3