Files
marqdo-app-harness/scripts/tauri/stage-tree.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

43 lines
1.7 KiB
Bash
Executable File

#!/usr/bin/env bash
# Stage the production MQDH tree as one runtime archive for Windows/macOS.
#
# The shell ships the verified tree as `resources/mqdh-runtime.tar.gz` and
# extracts it into MQDH_HOME on first start (Tauri's bundler drops symlinks, and
# pnpm node_modules is symlink-based). Linux reuses the cold-install-verified
# archive from scripts/package.sh; native lanes stage the same repository
# content with the platform Node runtime.
set -euo pipefail
cd "$(dirname "$0")/../.."
root="$PWD"
resources="src-tauri/resources"
rm -rf "$resources"
mkdir -p "$resources"
work="$(mktemp -d)"
trap 'rm -rf "$work"' EXIT
tree="$work/mqdh"
mkdir -p "$tree"
tar -C "$root" -cf - \
--exclude=.git --exclude=.ci --exclude=.build --exclude=.scratch \
--exclude=.issue-work --exclude=.app-verify --exclude=.integration-work \
--exclude=node_modules/.cache --exclude='*.log' --exclude='*.tsbuildinfo' \
--exclude=src-tauri/target --exclude=src-tauri/resources . \
| tar -C "$tree" -xf -
source_sha="${MQDH_SOURCE_SHA:-$(git rev-parse HEAD)}"
printf '%s\n' "$source_sha" > "$tree/SOURCE_SHA"
node_name="node"
case "$(uname -s)" in
MINGW*|MSYS*|CYGWIN*) node_name="node.exe" ;;
esac
mkdir -p "$tree/runtime"
node_binary="$(command -v node)"
cp "$node_binary" "$tree/runtime/$node_name"
"$tree/runtime/$node_name" --version > "$tree/runtime/VERSION"
test -f "$tree/scripts/mqdh.mjs"
test -f "$tree/apps/cli/lib/bin.js"
test -f "$tree/apps/web/dist/index.html"
# An uncompressed tar keeps Windows/macOS staging fast (single stream write);
# the shell detects gzip magic and reads either form. Installers compress it.
tar -cf "$resources/mqdh-runtime.archive" -C "$work" mqdh
ls -lh "$resources/mqdh-runtime.archive"
echo "stage-tree: OK $resources/mqdh-runtime.archive"