26 lines
826 B
JavaScript
26 lines
826 B
JavaScript
import { spawnSync } from "node:child_process";
|
|
import path from "node:path";
|
|
import { fileURLToPath } from "node:url";
|
|
|
|
const desktop = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "..");
|
|
const cli = path.join(desktop, "node_modules", "@tauri-apps", "cli", "tauri.js");
|
|
const args = process.argv.slice(2);
|
|
|
|
if (args[0] === "build" || args[0] === "bundle") {
|
|
if (args[0] === "build") {
|
|
const freeze = spawnSync("npm", ["run", "backend:freeze"], {
|
|
cwd: desktop,
|
|
stdio: "inherit",
|
|
shell: true,
|
|
});
|
|
if ((freeze.status ?? 1) !== 0) process.exit(freeze.status ?? 1);
|
|
}
|
|
args.push("--config", path.join("src-tauri", "tauri.release.conf.json"));
|
|
}
|
|
|
|
const result = spawnSync(process.execPath, [cli, ...args], {
|
|
cwd: desktop,
|
|
stdio: "inherit",
|
|
});
|
|
process.exit(result.status ?? 1);
|