feat(launcher): bundle Bun and use it across all launchers (#243)

This commit is contained in:
2026-09-11 00:21:10 -07:00
committed by GitHub
parent fb2d1a512b
commit 016a43b804
61 changed files with 6814 additions and 294 deletions
+26 -11
View File
@@ -2,23 +2,38 @@
set -euo pipefail
REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
LAUNCHER_OUT="$REPO_ROOT/dist/launcher/subminer"
LAUNCHER_DIR="$REPO_ROOT/dist/launcher"
LAUNCHER_OUT="$LAUNCHER_DIR/subminer"
EXPECTED_ARTIFACTS=(prepare.cjs subminer subminer.cmd subminer.js version)
if [[ ! -f "$REPO_ROOT/launcher/main.ts" ]]; then
echo "[FAIL] launcher source missing: launcher/main.ts"
exit 1
fi
if ! grep -Fn -- "--outfile=\"\$(LAUNCHER_OUT)\"" "$REPO_ROOT/Makefile" >/dev/null; then
echo "[FAIL] Makefile build-launcher target is not writing to dist/launcher/subminer"
if ! grep -F -- "bun run build:launcher" "$REPO_ROOT/Makefile" >/dev/null; then
echo "[FAIL] Makefile build-launcher target does not call the canonical package script"
exit 1
fi
if [[ ! -f "$LAUNCHER_OUT" ]]; then
echo "[FAIL] generated launcher not found at dist/launcher/subminer"
echo " run: make build-launcher"
exit 1
fi
for artifact in "${EXPECTED_ARTIFACTS[@]}"; do
if [[ ! -f "$LAUNCHER_DIR/$artifact" ]]; then
echo "[FAIL] generated launcher artifact missing: dist/launcher/$artifact"
echo " run: make build-launcher"
exit 1
fi
done
for artifact_path in "$LAUNCHER_DIR"/*; do
artifact="${artifact_path##*/}"
case "$artifact" in
prepare.cjs | subminer | subminer.cmd | subminer.js | version) ;;
*)
echo "[FAIL] dist/launcher contains an unexpected runtime artifact: $artifact"
exit 1
;;
esac
done
if [[ ! -x "$LAUNCHER_OUT" ]]; then
echo "[FAIL] generated launcher is not executable: dist/launcher/subminer"
@@ -32,11 +47,11 @@ if [[ -f "$REPO_ROOT/subminer" ]]; then
exit 1
fi
if git -C "$REPO_ROOT" ls-files --error-unmatch dist/launcher/subminer >/dev/null 2>&1; then
echo "[FAIL] dist/launcher/subminer is tracked by git; generated artifacts must remain untracked"
if git -C "$REPO_ROOT" ls-files --error-unmatch dist/launcher >/dev/null 2>&1; then
echo "[FAIL] dist/launcher contains tracked files; generated artifacts must remain untracked"
exit 1
fi
echo "[OK] launcher workflow verified"
echo " source: launcher/*.ts"
echo " generated artifact: dist/launcher/subminer"
echo " generated artifacts: ${EXPECTED_ARTIFACTS[*]}"