|
|
|
|
@ -3,6 +3,12 @@ const fs = require("fs-extra");
|
|
|
|
|
|
|
|
|
|
const APP_NAME = "TriliumNext Notes";
|
|
|
|
|
|
|
|
|
|
const extraResourcesForPlatform = getExtraResourcesForPlatform();
|
|
|
|
|
const baseLinuxMakerConfigOptions = {
|
|
|
|
|
icon: "./images/app-icons/png/128x128.png",
|
|
|
|
|
desktopTemplate: path.resolve("./bin/electron-forge/desktop.ejs"),
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
module.exports = {
|
|
|
|
|
packagerConfig: {
|
|
|
|
|
executableName: "trilium",
|
|
|
|
|
@ -12,7 +18,7 @@ module.exports = {
|
|
|
|
|
icon: "./images/app-icons/icon",
|
|
|
|
|
extraResource: [
|
|
|
|
|
// Moved to root
|
|
|
|
|
...getExtraResourcesForPlatform(),
|
|
|
|
|
...extraResourcesForPlatform,
|
|
|
|
|
|
|
|
|
|
// Moved to resources (TriliumNext Notes.app/Contents/Resources on macOS)
|
|
|
|
|
"translations/",
|
|
|
|
|
@ -20,22 +26,18 @@ module.exports = {
|
|
|
|
|
],
|
|
|
|
|
afterComplete: [
|
|
|
|
|
(buildPath, _electronVersion, platform, _arch, callback) => {
|
|
|
|
|
const extraResources = getExtraResourcesForPlatform();
|
|
|
|
|
for (const resource of extraResources) {
|
|
|
|
|
for (const resource of extraResourcesForPlatform) {
|
|
|
|
|
const baseName = path.basename(resource);
|
|
|
|
|
let sourcePath;
|
|
|
|
|
if (platform === "darwin") {
|
|
|
|
|
sourcePath = path.join(buildPath, `${APP_NAME}.app`, "Contents", "Resources", baseName);
|
|
|
|
|
} else {
|
|
|
|
|
sourcePath = path.join(buildPath, "resources", baseName);
|
|
|
|
|
}
|
|
|
|
|
let destPath;
|
|
|
|
|
|
|
|
|
|
if (baseName !== "256x256.png") {
|
|
|
|
|
destPath = path.join(buildPath, baseName);
|
|
|
|
|
} else {
|
|
|
|
|
destPath = path.join(buildPath, "icon.png");
|
|
|
|
|
}
|
|
|
|
|
// prettier-ignore
|
|
|
|
|
const sourcePath = (platform === "darwin")
|
|
|
|
|
? path.join(buildPath, `${APP_NAME}.app`, "Contents", "Resources", baseName)
|
|
|
|
|
: path.join(buildPath, "resources", baseName);
|
|
|
|
|
|
|
|
|
|
// prettier-ignore
|
|
|
|
|
const destPath = (baseName !== "256x256.png")
|
|
|
|
|
? path.join(buildPath, baseName)
|
|
|
|
|
: path.join(buildPath, "icon.png");
|
|
|
|
|
|
|
|
|
|
// Copy files from resources folder to root
|
|
|
|
|
fs.move(sourcePath, destPath)
|
|
|
|
|
@ -53,8 +55,7 @@ module.exports = {
|
|
|
|
|
name: "@electron-forge/maker-deb",
|
|
|
|
|
config: {
|
|
|
|
|
options: {
|
|
|
|
|
icon: "./images/app-icons/png/128x128.png",
|
|
|
|
|
desktopTemplate: path.resolve("./bin/electron-forge/desktop.ejs")
|
|
|
|
|
...baseLinuxMakerConfigOptions
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
@ -62,8 +63,7 @@ module.exports = {
|
|
|
|
|
name: "@electron-forge/maker-rpm",
|
|
|
|
|
config: {
|
|
|
|
|
options: {
|
|
|
|
|
icon: "./images/app-icons/png/128x128.png",
|
|
|
|
|
desktopTemplate: path.resolve("./bin/electron-forge/desktop.ejs")
|
|
|
|
|
...baseLinuxMakerConfigOptions
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
@ -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;
|
|
|
|
|
|