From 48c9735d7137fa4006c0a79fff7c4fd588d04f48 Mon Sep 17 00:00:00 2001 From: Leons Aleksandrovs Date: Fri, 21 Nov 2025 10:49:49 +0200 Subject: [PATCH] build only when needed --- scripts/build-watch.sh | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/scripts/build-watch.sh b/scripts/build-watch.sh index 23b1a32..0276843 100644 --- a/scripts/build-watch.sh +++ b/scripts/build-watch.sh @@ -1,2 +1,21 @@ -watchexec --debounce 2s -w . "npm run build && sh local-remote.sh" +upload() { + sh local-remote.sh --dry-run | grep -E "(\.less|\.js|\.vue|\.css)" + + if [ $? -eq 0 ]; then + echo "Changes detected in build files - running build..." + npm run build && sh local-remote.sh + else + echo "No build files changed - uploading directly..." + sh local-remote.sh + fi +} + +if [ "$1" = "--upload" ]; then + upload + exit 0 +fi + +sh "remote-local.sh" + +watchexec --debounce 2s -w . 'sh watch-build.sh --upload'