From 36f6e773eb4214c466de9f65d80b112fdb61563e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hugo=20H=C3=B6rnquist?= Date: Wed, 9 Mar 2022 00:56:57 +0100 Subject: Add alt make-watch for static in existing TMUX sessions. --- static/Makefile | 9 ++------- static/make-watch | 23 +++++++++++++++++++++++ 2 files changed, 25 insertions(+), 7 deletions(-) create mode 100755 static/make-watch diff --git a/static/Makefile b/static/Makefile index e567c350..2897c6bb 100644 --- a/static/Makefile +++ b/static/Makefile @@ -5,6 +5,7 @@ WATCH= # script explicitly named, since that is our entry point TS_FILES = script.ts $(shell find . -type f -name \*.ts -not -path */node_modules/*) +JS_FILES = $(TS_FILES:%.ts=%.js) export PATH := $(shell npm bin):$(PATH) @@ -20,14 +21,8 @@ script.out.js: $(TS_FILES) 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: - tmux \ - new-session "scss --watch -I. style.scss:style.css" \; \ - split-window "tsc --watch" \; \ - rename-session "calp watch" \; \ - select-layout even-vertical + ./make-watch install: all install -m644 -t $(DESTDIR)/usr/share/calp/www/ $(TARGETS) diff --git a/static/make-watch b/static/make-watch new file mode 100755 index 00000000..c985b37f --- /dev/null +++ b/static/make-watch @@ -0,0 +1,23 @@ +#!/bin/bash + +here=$(dirname "$(realpath "$0")") +cd "$here" || { + echo "Failed to cd to location of script ($here)" + exit 1 +} + +export PATH="$here/node_modules/.bin:$PATH" + +# Note that 'tsc --watch' doesn't provide the files we are using. It's +# just here for debug. +if [ -n "$TMUX" ]; then + tmux new-window "scss --watch -I. style.scss:style.css" + tmux new-window "tsc --watch" +else + tmux \ + new-session "scss --watch -I. style.scss:style.css" \; \ + split-window "tsc --watch" \; \ + rename-session "calp watch" \; \ + select-layout even-vertical + + fi -- cgit v1.2.3