Files
Firelink/scripts/before-tauri-bundle.js
T
NimBold 725f5e40ec fix(build): isolate engine staging per invocation
- remove shared staging locks and the repository engine tree
- stage verified target payloads in private atomic workspaces
- fence Tauri bundles and process-tree cleanup across platforms
- align CI, AppImage packaging, smoke checks, and release docs
2026-08-31 01:11:56 +03:30

31 lines
1.1 KiB
JavaScript

#!/usr/bin/env node
import fs from 'node:fs';
import path from 'node:path';
import { resolveOutputRoot, resolveTargetTriple } from './engine-workspace.js';
if (
process.env.FIRELINK_SKIP_ENGINE_RESOURCE === '1'
|| process.env.FIRELINK_ENGINE_BUNDLE_PREPARED === '1'
) {
process.exit(0);
}
// Staging belongs to beforeBuildCommand or the standalone-bundle wrapper.
// This hook is a read-only fence against a missing payload immediately before
// Tauri consumes the resource tree.
const target = resolveTargetTriple();
const outputRoot = resolveOutputRoot();
const suffix = target.includes('windows') ? '.exe' : '';
const destination = path.join(outputRoot, target);
const expectedNames = ['yt-dlp', 'aria2c', 'ffmpeg', 'deno']
.map(engine => `${engine}-${target}${suffix}`);
for (const name of expectedNames) {
const candidate = path.join(destination, name);
if (!fs.existsSync(candidate) || !fs.lstatSync(candidate).isFile()) {
throw new Error(`Prepared engine payload is incomplete: ${candidate}`);
}
}
console.log(`Prepared engine payload is present for ${target} at ${destination}`);