From 3a9be0410819616a3bc6918e22d1f0ada3bdec81 Mon Sep 17 00:00:00 2001 From: danielhanchen Date: Mon, 6 Jul 2026 10:32:33 +0000 Subject: [PATCH] Guard the frontend freshness find against missing src/public dirs Under set -euo pipefail, find over a missing directory exits non-zero, and the command substitution propagates that so setup aborts on a slim dist-only layout (a PyPI wheel that ships frontend/dist without src/ or public/). Pass only the directories that exist to find, so the cache-hit path completes instead of aborting. --- studio/setup.sh | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/studio/setup.sh b/studio/setup.sh index 98d6d4b8f4..c5055d6d02 100755 --- a/studio/setup.sh +++ b/studio/setup.sh @@ -51,10 +51,16 @@ if [ -d "$SCRIPT_DIR/frontend/dist" ]; then _changed=$(find "$SCRIPT_DIR/frontend" -maxdepth 1 \ \( -name "*.json" -o -name "*.ts" -o -name "*.js" -o -name "*.mjs" -o -name "*.html" \) \ -newer "$SCRIPT_DIR/frontend/dist" -print -quit 2>/dev/null) - # Check src/ and public/ recursively + # Check src/ and public/ recursively (only dirs that exist; a slimmed + # layout that ships dist/ without src/ or public/ must not abort under set -e) if [ -z "$_changed" ]; then - _changed=$(find "$SCRIPT_DIR/frontend/src" "$SCRIPT_DIR/frontend/public" \ - -type f -newer "$SCRIPT_DIR/frontend/dist" -print -quit 2>/dev/null) + _src_dirs=() + [ -d "$SCRIPT_DIR/frontend/src" ] && _src_dirs+=("$SCRIPT_DIR/frontend/src") + [ -d "$SCRIPT_DIR/frontend/public" ] && _src_dirs+=("$SCRIPT_DIR/frontend/public") + if [ "${#_src_dirs[@]}" -gt 0 ]; then + _changed=$(find "${_src_dirs[@]}" \ + -type f -newer "$SCRIPT_DIR/frontend/dist" -print -quit 2>/dev/null) + fi fi if [ -z "$_changed" ]; then _NEED_FRONTEND_BUILD=false