feat: 画布式 RPA 桌面端 Day1(1016 目录/画布/容器/属性/持久化)
This commit is contained in:
commit
32ca0a1af8
34 files changed
+15141
No files matched your search
@@ -0,0 +1,29 @@
|
||||
/**
|
||||
* 本地开发启动器。
|
||||
*
|
||||
* Electron 在本工作区(D:\RPA)下会因工作区 ACL/沙箱限制无法直接启动,
|
||||
* 因此允许通过 RPA_ELECTRON_DIST 指向一个可用的 Electron 运行时目录。
|
||||
* 例如:set RPA_ELECTRON_DIST=C:\electron-rpa\dist
|
||||
*/
|
||||
import { spawn } from "node:child_process";
|
||||
import fs from "node:fs";
|
||||
import path from "node:path";
|
||||
|
||||
const candidates = [
|
||||
process.env.RPA_ELECTRON_DIST,
|
||||
"C:/electron-rpa/dist",
|
||||
path.join(process.cwd(), "node_modules", "electron", "dist")
|
||||
].filter(Boolean);
|
||||
|
||||
const dist = candidates.find((candidate) => fs.existsSync(path.join(candidate, "electron.exe")));
|
||||
if (!dist) {
|
||||
console.error("找不到可用的 Electron 运行时。请设置 RPA_ELECTRON_DIST 指向包含 electron.exe 的目录。");
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
const env = { ...process.env, ELECTRON_OVERRIDE_DIST_PATH: dist };
|
||||
delete env.ELECTRON_RUN_AS_NODE;
|
||||
|
||||
console.log(`[dev] electron dist: ${dist}`);
|
||||
const child = spawn("npx.cmd", ["electron-vite", "dev"], { stdio: "inherit", env, shell: true });
|
||||
child.on("exit", (code) => process.exit(code ?? 0));
|
||||
Reference in new issue
Block a user