Skip to content

ServerKit is a lightweight, modern server control panel for managing web applications, databases, and services on your VPS or dedicated server. Built with Python/Flask backend and React frontend.

fix(release): keep frontend/src image assets in the release tarball (#127)

Juan Denis73c962b2d257
diff --git a/scripts/build-release.sh b/scripts/build-release.sh
index ef989ed3..a7025c6f 100644
--- a/scripts/build-release.sh
+++ b/scripts/build-release.sh
@@ -168,11 +168,15 @@ rm -rf "$BUILD_DIR/frontend/node_modules"
find "$BUILD_DIR" -type d -name __pycache__ -exec rm -rf {} + 2>/dev/null || true
find "$BUILD_DIR" -type d -name .pytest_cache -exec rm -rf {} + 2>/dev/null || true
find "$BUILD_DIR" -type f -name '*.pyc' -delete 2>/dev/null || true
-# Never strip the built SPA bundle: Vite emits real image assets into
-# frontend/dist/assets (extension icons, etc.) that the panel 404s without.
+# Never strip anything under frontend/: dist/assets holds the images Vite
+# emitted (extension icons, etc.) that the panel 404s without, and src/assets
+# holds the ones the JS imports — delete those and the shipped tree can no
+# longer rebuild its own frontend (`serverkit doctor --fix` on 1.9.x died on
+# 18 unresolved png imports, issue #127). The tar excludes above already keep
+# docs/dev screenshots out; this pass only catches stragglers elsewhere.
# (Use ! -path, not -prune: -delete implies -depth, which disables -prune.)
find "$BUILD_DIR" -type f \( -name '*.png' -o -name '*.jpeg' -o -name '*.jpg' \) \
- ! -path "$BUILD_DIR/frontend/dist/*" -delete 2>/dev/null || true
+ ! -path "$BUILD_DIR/frontend/*" -delete 2>/dev/null || true
# Runtime directory the app expects to exist.
mkdir -p "$BUILD_DIR/backend/instance"
diff --git a/scripts/test/test_release_workflow.sh b/scripts/test/test_release_workflow.sh
index 21aca2ea..2165db2f 100644
--- a/scripts/test/test_release_workflow.sh
+++ b/scripts/test/test_release_workflow.sh
@@ -74,6 +74,16 @@ expect_text "$RELEASE" 'Refusing to overwrite existing release' \
expect_text "$RELEASE" 'overwrite_files: false' \
'release assets cannot be overwritten'
+# The release tarball must be able to rebuild its own frontend: build-release
+# used to strip every png outside frontend/dist, which emptied
+# frontend/src/assets and made any rebuild from /opt/serverkit die on
+# unresolved imports (issue #127).
+BUILD_RELEASE="$ROOT/scripts/build-release.sh"
+expect_text "$BUILD_RELEASE" '! -path "$BUILD_DIR/frontend/*"' \
+ 'release image cleanup leaves the whole frontend/ tree alone'
+expect_absent "$BUILD_RELEASE" '! -path "$BUILD_DIR/frontend/dist/*" -delete' \
+ 'release image cleanup no longer strips frontend/src assets'
+
if [ "$failures" -ne 0 ]; then
printf '\n%d release workflow guard assertion(s) failed\n' "$failures" >&2
exit 1