refactor(forge.config): simplify getExtraResourcesForPlatform

This commit is contained in:
Panagiotis Papadopoulos 2025-02-05 09:56:08 +01:00
parent 2b83470de6
commit 62099abb29

View File

@ -100,21 +100,20 @@ module.exports = {
}; };
function getExtraResourcesForPlatform() { function getExtraResourcesForPlatform() {
let resources = ["dump-db/", "./bin/tpl/anonymize-database.sql"]; const resources = ["dump-db/", "./bin/tpl/anonymize-database.sql"];
const scripts = ["trilium-portable", "trilium-safe-mode", "trilium-no-cert-check"];
const getScriptRessources = () => {
const scripts = ["trilium-portable", "trilium-safe-mode", "trilium-no-cert-check"];
const scriptExt = (process.platform === "win32") ? "bat" : "sh";
return scripts.map(script => `./bin/tpl/${script}.${scriptExt}`);
}
switch (process.platform) { switch (process.platform) {
case "win32": case "win32":
for (const script of scripts) { resources.push(...getScriptRessources())
resources.push(`./bin/tpl/${script}.bat`);
}
break;
case "darwin":
break; break;
case "linux": case "linux":
resources.push("images/app-icons/png/256x256.png"); resources.push(...getScriptRessources(), "images/app-icons/png/256x256.png");
for (const script of scripts) {
resources.push(`./bin/tpl/${script}.sh`);
}
break; break;
default: default:
break; break;