mirror of
https://github.com/ksyasuda/SubMiner.git
synced 2026-09-11 17:16:18 -07:00
feat(launcher): use private Bun for all release launchers
This commit is contained in:
@@ -620,6 +620,8 @@ test('writePrereleaseNotesForVersion writes cumulative beta notes without mutati
|
||||
assert.match(prereleaseNotes, /## Highlights\n### Added\n- Polished: added entry\./);
|
||||
assert.match(prereleaseNotes, /### Fixed\n- Polished: fixed entry\./);
|
||||
assert.match(prereleaseNotes, /## Installation\n\nSee the README and docs\/installation guide/);
|
||||
assert.match(prereleaseNotes, /Windows `subminer\.cmd` launcher/);
|
||||
assert.match(prereleaseNotes, /Both launcher downloads use Bun included with the SubMiner app/);
|
||||
} finally {
|
||||
fs.rmSync(workspace, { recursive: true, force: true });
|
||||
}
|
||||
|
||||
@@ -977,9 +977,9 @@ function renderReleaseNotes(
|
||||
'- Linux: `SubMiner.AppImage`',
|
||||
'- macOS: `SubMiner-*.dmg` and `SubMiner-*.zip`',
|
||||
'- Windows: `SubMiner-*.exe` and `SubMiner-*-win.zip`',
|
||||
'- Optional extras: `subminer-assets.tar.gz` and the `subminer` launcher',
|
||||
'- Optional extras: `subminer-assets.tar.gz`, the `subminer` launcher, and the Windows `subminer.cmd` launcher',
|
||||
'',
|
||||
"The launcher installed by desktop setup uses the app's bundled Bun runtime. Only the separately downloaded `subminer` script requires Bun installed on `PATH`.",
|
||||
'Both launcher downloads use Bun included with the SubMiner app. Download `subminer` on Linux or macOS and `subminer.cmd` on Windows.',
|
||||
'',
|
||||
].join('\n');
|
||||
}
|
||||
|
||||
@@ -0,0 +1,54 @@
|
||||
import fs from 'node:fs';
|
||||
import path from 'node:path';
|
||||
import { execFileSync } from 'node:child_process';
|
||||
import packageJson from '../package.json';
|
||||
import { posixLauncherBootstrapContent } from '../src/main/runtime/posix-launcher-bootstrap';
|
||||
import { windowsLauncherBootstrapContent } from '../src/main/runtime/windows-launcher-bootstrap';
|
||||
|
||||
const outputDirectory = path.join(process.cwd(), 'dist', 'launcher');
|
||||
|
||||
function bundle(options: {
|
||||
entrypoint: string;
|
||||
outfile: string;
|
||||
target: 'bun' | 'node';
|
||||
format?: 'cjs';
|
||||
banner?: string;
|
||||
}): void {
|
||||
const args = [
|
||||
'build',
|
||||
options.entrypoint,
|
||||
`--outfile=${options.outfile}`,
|
||||
`--target=${options.target}`,
|
||||
'--packages=bundle',
|
||||
];
|
||||
if (options.format) args.push(`--format=${options.format}`);
|
||||
if (options.banner) args.push(`--banner=${options.banner}`);
|
||||
execFileSync(process.execPath, args, { stdio: 'inherit' });
|
||||
}
|
||||
|
||||
fs.mkdirSync(outputDirectory, { recursive: true });
|
||||
|
||||
bundle({
|
||||
entrypoint: path.join(process.cwd(), 'launcher', 'main.ts'),
|
||||
outfile: path.join(outputDirectory, 'subminer.js'),
|
||||
target: 'bun',
|
||||
banner: '#!/usr/bin/env bun',
|
||||
});
|
||||
bundle({
|
||||
entrypoint: path.join(process.cwd(), 'src', 'main', 'runtime', 'prepare-launcher-runtime.ts'),
|
||||
outfile: path.join(outputDirectory, 'prepare.cjs'),
|
||||
target: 'node',
|
||||
format: 'cjs',
|
||||
});
|
||||
|
||||
const posixLauncherPath = path.join(outputDirectory, 'subminer');
|
||||
fs.writeFileSync(posixLauncherPath, posixLauncherBootstrapContent(), { mode: 0o755 });
|
||||
fs.chmodSync(posixLauncherPath, 0o755);
|
||||
fs.writeFileSync(
|
||||
path.join(outputDirectory, 'subminer.cmd'),
|
||||
windowsLauncherBootstrapContent(),
|
||||
'utf8',
|
||||
);
|
||||
fs.writeFileSync(path.join(outputDirectory, 'version'), `${packageJson.version}\n`, 'utf8');
|
||||
|
||||
console.log(`Built launcher runtime artifacts in ${outputDirectory}`);
|
||||
@@ -70,6 +70,7 @@ test('update-aur-package updates PKGBUILD and .SRCINFO without makepkg', () => {
|
||||
);
|
||||
|
||||
assert.match(pkgbuild, /^pkgver=0\.6\.3$/m);
|
||||
assert.doesNotMatch(pkgbuild, /^\s*'bun'$/m);
|
||||
assert.match(
|
||||
pkgbuild,
|
||||
/^\s*"subminer-\$\{pkgver\}::https:\/\/github\.com\/ksyasuda\/SubMiner\/releases\/download\/v\$\{pkgver\}\/subminer"$/m,
|
||||
@@ -84,6 +85,7 @@ test('update-aur-package updates PKGBUILD and .SRCINFO without makepkg', () => {
|
||||
);
|
||||
assert.match(pkgbuild, /assets\/thumbnailers\/subminer-ffmpegthumbnailer\.thumbnailer/);
|
||||
assert.match(srcinfo, /^\tpkgver = 0\.6\.3$/m);
|
||||
assert.doesNotMatch(srcinfo, /^\tdepends = bun$/m);
|
||||
assert.match(srcinfo, /^\tprovides = subminer=0\.6\.3$/m);
|
||||
assert.match(
|
||||
srcinfo,
|
||||
|
||||
@@ -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[*]}"
|
||||
|
||||
Reference in New Issue
Block a user