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'