Files
openscreen/scripts/before-pack.cjs
T
2026-06-05 20:22:02 -07:00

15 lines
657 B
JavaScript

// electron-builder beforePack hook: ensure the auto-caption assets (Whisper model + ORT wasm) exist
// before packaging, so the `caption-assets` extraResources entry has something to copy. Runs for
// every package invocation — local `npm run build:*` and CI's bare `electron-builder` alike. The
// fetch script is idempotent, so this is a no-op once the assets are present.
const { execFileSync } = require("node:child_process");
const path = require("node:path");
exports.default = async function beforePack() {
execFileSync("node", [path.join(__dirname, "fetch-caption-model.mjs")], {
stdio: "inherit",
cwd: path.join(__dirname, ".."),
});
};