chore(build): add support for prebuilt frontend assets in macOS and Windows build scripts

This commit is contained in:
Ivan
2026-04-20 21:12:58 -05:00
parent 6af8f8a7ea
commit 01e815ab79
2 changed files with 30 additions and 3 deletions
+14 -1
View File
@@ -15,7 +15,20 @@ export MESHCHATX_SKIP_BACKEND_MANIFEST=1
pnpm run electron-postinstall
pnpm run version:sync
pnpm run build-frontend
# Skip frontend rebuild when CI provides a prebuilt meshchatx/public artifact
# via the reusable Frontend build workflow. Local invocations leave the flag
# unset and continue to build everything from source.
if [[ "${MESHCHATX_FRONTEND_PREBUILT:-0}" != "1" ]]; then
pnpm run build-frontend
pnpm run build-docs
else
if [[ ! -f "meshchatx/public/index.html" ]]; then
echo "MESHCHATX_FRONTEND_PREBUILT=1 but meshchatx/public/index.html is missing." >&2
echo "Download the frontend artifact into meshchatx/public/ before invoking this script." >&2
exit 1
fi
echo "Reusing prebuilt frontend assets in meshchatx/public/."
fi
cross-env ARCH=arm64 pnpm run build-backend
if [[ -n "${PYTHON_CMD_X64:-}" ]]; then
cross-env ARCH=x64 PYTHON_CMD="$PYTHON_CMD_X64" pnpm run build-backend
+16 -2
View File
@@ -1,5 +1,10 @@
#!/usr/bin/env bash
# Build Windows portable + NSIS installers (electron-builder). See package.json dist:windows.
# Build Windows portable + NSIS installers (electron-builder).
#
# When MESHCHATX_FRONTEND_PREBUILT=1 the script reuses the prebuilt
# meshchatx/public/ artifact downloaded from the reusable Frontend build
# workflow and only rebuilds the cx_Freeze backend. Otherwise it falls back to
# the full pnpm dist:windows pipeline (frontend + docs + backend).
set -euo pipefail
ROOT="$(cd "$(dirname "$0")/../.." && pwd)"
@@ -7,4 +12,13 @@ cd "$ROOT"
git config --global core.longpaths true 2>/dev/null || true
pnpm run dist:windows
if [[ "${MESHCHATX_FRONTEND_PREBUILT:-0}" == "1" ]]; then
if [[ ! -f "meshchatx/public/index.html" ]]; then
echo "MESHCHATX_FRONTEND_PREBUILT=1 but meshchatx/public/index.html is missing." >&2
echo "Download the frontend artifact into meshchatx/public/ before invoking this script." >&2
exit 1
fi
pnpm run dist:windows-prebuilt
else
pnpm run dist:windows
fi