fix: 随包分发运行时资源目录
This commit is contained in:
parent
cf05e4aa6f
commit
4fb0f64d4f
@ -20,6 +20,10 @@ export default {
|
||||
"out/**/*",
|
||||
"package.json"
|
||||
],
|
||||
extraResources: [
|
||||
{ from: path.join(root, "resources", "catalog.json"), to: "catalog.json" },
|
||||
{ from: path.join(root, "resources", "fixture"), to: "fixture" }
|
||||
],
|
||||
asar: true,
|
||||
compression: "maximum",
|
||||
npmRebuild: false,
|
||||
@ -45,4 +49,4 @@ export default {
|
||||
deleteAppDataOnUninstall: false
|
||||
},
|
||||
publish: null
|
||||
};
|
||||
};
|
||||
|
||||
@ -107,6 +107,15 @@ if (!fs.existsSync(builderSetupPath)) {
|
||||
if (!fs.existsSync(path.join(builderUnpacked, "RPA Studio.exe"))) {
|
||||
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.copyFileSync(builderSetupPath, setupPath);
|
||||
removeTree(builderWork);
|
||||
@ -198,6 +207,9 @@ if (installed.status !== 0 || installed.error) {
|
||||
if (!fs.existsSync(path.join(installSmokeTarget, "RPA Studio.exe"))) {
|
||||
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");
|
||||
removeTree(installSmokeRoot);
|
||||
|
||||
@ -207,4 +219,4 @@ const sums = [
|
||||
];
|
||||
fs.writeFileSync(path.join(releaseRoot, "SHA256SUMS.txt"), `${sums.join("\r\n")}\r\n`, "utf8");
|
||||
|
||||
console.log(JSON.stringify({ productFolder, zipPath, setupPath, zipSha256, setupSha256 }, null, 2));
|
||||
console.log(JSON.stringify({ productFolder, zipPath, setupPath, zipSha256, setupSha256 }, null, 2));
|
||||
|
||||
Loading…
Reference in New Issue
Block a user