From 09df1c2d1703341f930354286f246aa4e7a79ce9 Mon Sep 17 00:00:00 2001 From: ciregenz Date: Sun, 9 Aug 2026 17:04:58 -0700 Subject: [PATCH] [eric] build: the webapp-template node_modules archive skips when already built for the digest, so an interrupted build stops re-running the 22s npm install every restart --- scripts/build-template-archive.sh | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/scripts/build-template-archive.sh b/scripts/build-template-archive.sh index 4b8455dc..8b3a56cf 100755 --- a/scripts/build-template-archive.sh +++ b/scripts/build-template-archive.sh @@ -35,6 +35,14 @@ else fi OUT_ARCHIVE="$OUT_DIR/node_modules.${PKG_DIGEST}.tar.gz" +# Already built for this exact package.json: skip the ~22s npm install (mirrors build-whisper.sh's +# version-stamped cache). This is both a build speedup AND the fix for the interrupted-build loop, +# where every restart re-ran the heavy install because nothing checked for the finished archive. +if [[ -f "$OUT_ARCHIVE" ]]; then + echo "[template-archive] $PKG_DIGEST already built, skipping" + exit 0 +fi + # Work in a temp dir so a failed install can't corrupt the template tree. WORK_DIR=$(mktemp -d -t openswarm-template-archive-XXXXXX) trap "rm -rf '$WORK_DIR'" EXIT