fix: 随包分发运行时资源目录
This commit is contained in:
1 parent
cf05e4aa6f
commit
4fb0f64d4f
2 files changed
+16
No files matched your search
@@ -20,6 +20,10 @@ export default {
|
|||||||
"out/**/*",
|
"out/**/*",
|
||||||
"package.json"
|
"package.json"
|
||||||
],
|
],
|
||||||
|
extraResources: [
|
||||||
|
{ from: path.join(root, "resources", "catalog.json"), to: "catalog.json" },
|
||||||
|
{ from: path.join(root, "resources", "fixture"), to: "fixture" }
|
||||||
|
],
|
||||||
asar: true,
|
asar: true,
|
||||||
compression: "maximum",
|
compression: "maximum",
|
||||||
npmRebuild: false,
|
npmRebuild: false,
|
||||||
|
|||||||
@@ -107,6 +107,15 @@ if (!fs.existsSync(builderSetupPath)) {
|
|||||||
if (!fs.existsSync(path.join(builderUnpacked, "RPA Studio.exe"))) {
|
if (!fs.existsSync(path.join(builderUnpacked, "RPA Studio.exe"))) {
|
||||||
throw new Error(`electron-builder 未生成应用目录:${builderUnpacked}`);
|
throw new Error(`electron-builder 未生成应用目录:${builderUnpacked}`);
|
||||||
}
|
}
|
||||||
|
const packagedCatalogPath = path.join(builderUnpacked, "resources", "catalog.json");
|
||||||
|
const packagedFixturePath = path.join(builderUnpacked, "resources", "fixture", "index.html");
|
||||||
|
if (!fs.existsSync(packagedCatalogPath) || !fs.existsSync(packagedFixturePath)) {
|
||||||
|
throw new Error("打包产物缺少运行资源:resources/catalog.json 或 resources/fixture/index.html");
|
||||||
|
}
|
||||||
|
const packagedCatalog = JSON.parse(fs.readFileSync(packagedCatalogPath, "utf8"));
|
||||||
|
if (!Array.isArray(packagedCatalog.components) || packagedCatalog.components.length === 0) {
|
||||||
|
throw new Error("打包产物 resources/catalog.json 无效:组件目录为空");
|
||||||
|
}
|
||||||
fs.cpSync(builderUnpacked, productFolder, { recursive: true });
|
fs.cpSync(builderUnpacked, productFolder, { recursive: true });
|
||||||
fs.copyFileSync(builderSetupPath, setupPath);
|
fs.copyFileSync(builderSetupPath, setupPath);
|
||||||
removeTree(builderWork);
|
removeTree(builderWork);
|
||||||
@@ -198,6 +207,9 @@ if (installed.status !== 0 || installed.error) {
|
|||||||
if (!fs.existsSync(path.join(installSmokeTarget, "RPA Studio.exe"))) {
|
if (!fs.existsSync(path.join(installSmokeTarget, "RPA Studio.exe"))) {
|
||||||
throw new Error("NSIS 安装包冒烟失败:未生成主程序");
|
throw new Error("NSIS 安装包冒烟失败:未生成主程序");
|
||||||
}
|
}
|
||||||
|
if (!fs.existsSync(path.join(installSmokeTarget, "resources", "catalog.json"))) {
|
||||||
|
throw new Error("NSIS 安装包冒烟失败:catalog.json 未安装");
|
||||||
|
}
|
||||||
await verifyLaunch(path.join(installSmokeTarget, "RPA Studio.exe"), "installed");
|
await verifyLaunch(path.join(installSmokeTarget, "RPA Studio.exe"), "installed");
|
||||||
removeTree(installSmokeRoot);
|
removeTree(installSmokeRoot);
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user