mirror of
https://github.com/zadam/trilium.git
synced 2025-10-29 09:16:45 +01:00
add electron-forge for all platforms
This commit is contained in:
@@ -1,18 +1,65 @@
|
||||
const path = require('path');
|
||||
const fs = require('fs-extra');
|
||||
|
||||
module.exports = {
|
||||
packagerConfig: {
|
||||
executableName: "trilium",
|
||||
name: 'trilium',
|
||||
overwrite: true,
|
||||
asar: true,
|
||||
// icon will break once we add .dmg support, since the .ico & .icns have to be in same dir (see https://www.electronforge.io/guides/create-and-add-icons#windows-and-macos)
|
||||
icon: "./images/app-icons/win/icon"
|
||||
icon: "./images/app-icons/icon",
|
||||
extraResource: getExtraResourcesForPlatform(),
|
||||
files: [{ from: './bin/tpl/anonymize-database.tql', to: '.' }],
|
||||
afterComplete: [(buildPath, electronVersion, platform, arch, callback) => {
|
||||
const extraResources = getExtraResourcesForPlatform();
|
||||
for (const resource of extraResources) {
|
||||
const sourcePath = path.join(buildPath, 'resources', path.basename(resource));
|
||||
const destPath = path.join(buildPath, path.basename(resource));
|
||||
|
||||
// Copy files from resources folder to root
|
||||
fs.move(sourcePath, destPath)
|
||||
.then(() => callback())
|
||||
.catch(err => callback(err));
|
||||
}
|
||||
}]
|
||||
},
|
||||
rebuildConfig: {
|
||||
force: true
|
||||
},
|
||||
rebuildConfig: {},
|
||||
makers: [
|
||||
{
|
||||
name: '@electron-forge/maker-deb',
|
||||
config: {
|
||||
options: {
|
||||
icon: "./images/app-icons/png/128x128.png",
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
name: '@electron-forge/maker-squirrel',
|
||||
config: {
|
||||
iconUrl: "https://raw.githubusercontent.com/TriliumNext/Notes/develop/images/app-icons/win/icon.ico",
|
||||
setupIcon: "./images/app-icons/win/icon.ico",
|
||||
iconUrl: "https://raw.githubusercontent.com/TriliumNext/Notes/develop/images/app-icons/icon.ico",
|
||||
setupIcon: "./images/app-icons/icon.ico",
|
||||
loadingGif: "./images/app-icons/win/setup-banner.gif"
|
||||
}
|
||||
},
|
||||
{
|
||||
name: '@electron-forge/maker-dmg',
|
||||
arch: ['x64', 'arm64'],
|
||||
config: {
|
||||
icon: "./images/app-icons/mac/icon.icns",
|
||||
}
|
||||
},
|
||||
{
|
||||
name: '@electron-forge/maker-zip',
|
||||
config: {
|
||||
options: {
|
||||
iconUrl: "https://raw.githubusercontent.com/TriliumNext/Notes/develop/images/app-icons/icon.ico",
|
||||
setupIcon: "./images/app-icons/icon.ico",
|
||||
loadingGif: "./images/app-icons/win/setup-banner.gif"
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
plugins: [
|
||||
@@ -22,3 +69,27 @@ module.exports = {
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
|
||||
function getExtraResourcesForPlatform() {
|
||||
let resources = ['dump-db/', './bin/tpl/anonymize-database.sql']
|
||||
const scripts = ['trilium-portable', 'trilium-safe-mode', 'trilium-no-cert-check']
|
||||
switch (process.platform) {
|
||||
case 'win32':
|
||||
for (const script of scripts) {
|
||||
resources.push(`./bin/tpl/${script}.bat`)
|
||||
}
|
||||
break;
|
||||
case 'darwin':
|
||||
break;
|
||||
case 'linux':
|
||||
for (const script of scripts) {
|
||||
resources.push(`./bin/tpl/${script}.sh`)
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return resources;
|
||||
}
|
||||
Reference in New Issue
Block a user