feat: 改为安装包分发并使用动态端口
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
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);
|
||||
Reference in New Issue
Block a user