Skip to content

Build your personal knowledge base with Trilium Notes

refactor(forge.config): simplify getExtraResourcesForPlatform

Panagiotis Papadopoulos62099abb2948
diff --git a/forge.config.cjs b/forge.config.cjs
index b4dd1a7ee5..b3765a35b9 100644
--- a/forge.config.cjs
+++ b/forge.config.cjs
@@ -100,21 +100,20 @@ module.exports = {
};
function getExtraResourcesForPlatform() {
- let resources = ["dump-db/", "./bin/tpl/anonymize-database.sql"];
- const scripts = ["trilium-portable", "trilium-safe-mode", "trilium-no-cert-check"];
+ const resources = ["dump-db/", "./bin/tpl/anonymize-database.sql"];
+
+ 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) {
case "win32":
- for (const script of scripts) {
- resources.push(`./bin/tpl/${script}.bat`);
- }
- break;
- case "darwin":
+ resources.push(...getScriptRessources())
break;
case "linux":
- resources.push("images/app-icons/png/256x256.png");
- for (const script of scripts) {
- resources.push(`./bin/tpl/${script}.sh`);
- }
+ resources.push(...getScriptRessources(), "images/app-icons/png/256x256.png");
break;
default:
break;