Files
marqdo-app-harness/scripts/tauri/prepare-resources.sh
T
cflmy 6839e82190 perf(mqdh): stage native runtime as a plain tar to keep Windows/macOS CI fast (#33)
gzip on a 2.7 GB pnpm tree takes tens of minutes on a 2-core Windows runner.
Stage an uncompressed tar under one neutral resource name; the shell detects the
gzip magic for the Linux verified archive and reads plain tar for native lanes.
Installers still compress the tar as part of NSIS/DMG bundling.
2026-12-03 16:58:34 +08:00

30 lines
1.4 KiB
Bash
Executable File

#!/usr/bin/env bash
# Stage the verified portable tree as one Tauri resource archive.
#
# Tauri's Linux deb walker drops symlinks, and a pnpm `node_modules` tree is
# built from symlinks. Shipping the cold-install-verified `.tar.gz` as a single
# resource keeps the exact verified tree (symlinks intact) and lets the shell
# extract it once into `MQDH_HOME/runtime` on first start.
set -euo pipefail
cd "$(dirname "$0")/../.."
version="$(sed -n 's/.*"version": *"\([^"]*\)".*/\1/p' packages/marqdo/harness/package.json | head -1)"
test -n "$version"
archive="${1:-.ci/marqdo-harness-${version}-x86_64-unknown-linux-gnu.tar.gz}"
test -f "$archive" || { echo "prepare-resources: missing $archive; run scripts/package.sh first" >&2; exit 1; }
resources="src-tauri/resources"
rm -rf "$resources"
mkdir -p "$resources"
cp "$archive" "$resources/mqdh-runtime.archive"
# The archive must contain the launcher, built CLI and web entries plus the
# Node runtime; this is the same tree scripts/package.sh cold-installed. Write
# the listing once: `tar | grep -q` would trip pipefail via SIGPIPE.
listing="$(mktemp)"
trap 'rm -f "$listing"' EXIT
tar -tzf "$resources/mqdh-runtime.archive" > "$listing"
grep -qE '^[^/]+/scripts/mqdh\.mjs$' "$listing"
grep -qE '^[^/]+/runtime/node$' "$listing"
grep -qE '^[^/]+/apps/web/dist/index\.html$' "$listing"
ls -lh "$resources/mqdh-runtime.archive"
echo "prepare-resources: OK $resources/mqdh-runtime.archive"