2024-12-02 00:44:02 +01:00
|
|
|
import { FuseV1Options, FuseVersion } from '@electron/fuses';
|
2024-11-16 16:55:45 +01:00
|
|
|
import { MakerDeb } from '@electron-forge/maker-deb';
|
|
|
|
|
import { MakerRpm } from '@electron-forge/maker-rpm';
|
2024-12-02 00:44:02 +01:00
|
|
|
import { MakerSquirrel } from '@electron-forge/maker-squirrel';
|
|
|
|
|
import { MakerZIP } from '@electron-forge/maker-zip';
|
2024-11-16 16:55:45 +01:00
|
|
|
import { FusesPlugin } from '@electron-forge/plugin-fuses';
|
2024-12-02 00:44:02 +01:00
|
|
|
import { VitePlugin } from '@electron-forge/plugin-vite';
|
|
|
|
|
import type { ForgeConfig } from '@electron-forge/shared-types';
|
2024-12-02 01:33:25 +01:00
|
|
|
|
2024-11-17 18:56:49 +01:00
|
|
|
import fs from 'fs/promises';
|
2024-11-16 16:55:45 +01:00
|
|
|
|
|
|
|
|
const config: ForgeConfig = {
|
|
|
|
|
packagerConfig: {
|
2024-11-17 18:56:49 +01:00
|
|
|
name: 'Colanode',
|
2024-12-02 23:06:10 +01:00
|
|
|
executableName: process.platform === 'linux' ? 'colanode' : 'Colanode',
|
2024-11-23 10:29:47 +01:00
|
|
|
icon: 'assets/colanode_logo_black',
|
|
|
|
|
appBundleId: 'com.colanode.desktop',
|
2024-11-16 16:55:45 +01:00
|
|
|
asar: true,
|
2024-11-17 17:05:19 +01:00
|
|
|
ignore: [
|
|
|
|
|
/^\/src/,
|
|
|
|
|
/^\/test/,
|
|
|
|
|
/^\/tools/,
|
|
|
|
|
/^\/release/,
|
|
|
|
|
/^\/docs/,
|
|
|
|
|
/^\/dist/,
|
2024-11-22 11:24:56 +01:00
|
|
|
/^\/assets/,
|
2024-11-17 17:05:19 +01:00
|
|
|
/\.git/,
|
|
|
|
|
/\.vscode/,
|
|
|
|
|
/\.idea/,
|
|
|
|
|
/^\/\.env/,
|
2024-11-22 11:24:56 +01:00
|
|
|
// Config files
|
|
|
|
|
/\.eslintrc\.json$/,
|
|
|
|
|
/components\.json$/,
|
|
|
|
|
/postcss\.config\.js$/,
|
|
|
|
|
/tailwind\.config\.js$/,
|
|
|
|
|
/tsconfig\.json$/,
|
|
|
|
|
/forge\.config\.ts$/,
|
|
|
|
|
/forge\.env\.d\.ts$/,
|
|
|
|
|
/vite\.base\.config\.ts$/,
|
|
|
|
|
/vite\.main\.config\.ts$/,
|
|
|
|
|
/vite\.renderer\.config\.ts$/,
|
|
|
|
|
/vite\.preload\.config\.ts$/,
|
2024-11-17 17:05:19 +01:00
|
|
|
// Don't ignore node_modules
|
2024-11-17 18:56:49 +01:00
|
|
|
// /^\/node_modules/,
|
2024-11-17 17:05:19 +01:00
|
|
|
],
|
|
|
|
|
extraResource: ['assets'],
|
2024-11-16 16:55:45 +01:00
|
|
|
},
|
|
|
|
|
rebuildConfig: {},
|
|
|
|
|
makers: [
|
2024-12-02 23:24:02 +01:00
|
|
|
new MakerSquirrel({
|
|
|
|
|
name: 'Colanode',
|
|
|
|
|
authors: 'Colanode',
|
|
|
|
|
description: 'Colanode Desktop Application',
|
|
|
|
|
setupExe: 'ColanodeSetup.exe',
|
|
|
|
|
}),
|
2024-11-16 16:55:45 +01:00
|
|
|
new MakerZIP({}, ['darwin']),
|
2024-12-02 23:06:10 +01:00
|
|
|
new MakerRpm({
|
|
|
|
|
options: {
|
|
|
|
|
bin: 'colanode',
|
|
|
|
|
name: 'colanode'
|
|
|
|
|
}
|
|
|
|
|
}),
|
|
|
|
|
new MakerDeb({
|
|
|
|
|
options: {
|
|
|
|
|
bin: 'colanode',
|
|
|
|
|
name: 'colanode'
|
|
|
|
|
}
|
|
|
|
|
}),
|
2024-11-16 16:55:45 +01:00
|
|
|
],
|
2024-11-17 19:17:23 +01:00
|
|
|
publishers: [
|
|
|
|
|
{
|
|
|
|
|
name: '@electron-forge/publisher-github',
|
|
|
|
|
config: {
|
|
|
|
|
repository: {
|
|
|
|
|
owner: 'colanode',
|
2024-11-22 11:24:56 +01:00
|
|
|
name: 'colanode',
|
2024-11-17 19:17:23 +01:00
|
|
|
},
|
2024-11-22 11:24:56 +01:00
|
|
|
// Publishing options:
|
|
|
|
|
// draft=true creates private release for review,
|
2024-11-17 19:17:23 +01:00
|
|
|
// prerelease=true marks as beta, false=stable/production
|
|
|
|
|
prerelease: false,
|
2024-11-22 11:24:56 +01:00
|
|
|
draft: true,
|
|
|
|
|
},
|
|
|
|
|
},
|
2024-11-17 19:17:23 +01:00
|
|
|
],
|
2024-11-16 16:55:45 +01:00
|
|
|
plugins: [
|
|
|
|
|
new VitePlugin({
|
|
|
|
|
// `build` can specify multiple entry builds, which can be Main process, Preload scripts, Worker process, etc.
|
|
|
|
|
// If you are familiar with Vite configuration, it will look really familiar.
|
|
|
|
|
build: [
|
|
|
|
|
{
|
|
|
|
|
// `entry` is just an alias for `build.lib.entry` in the corresponding file of `config`.
|
|
|
|
|
entry: 'src/main.ts',
|
|
|
|
|
config: 'vite.main.config.ts',
|
|
|
|
|
target: 'main',
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
entry: 'src/preload.ts',
|
|
|
|
|
config: 'vite.preload.config.ts',
|
|
|
|
|
target: 'preload',
|
|
|
|
|
},
|
|
|
|
|
],
|
|
|
|
|
renderer: [
|
|
|
|
|
{
|
|
|
|
|
name: 'main_window',
|
|
|
|
|
config: 'vite.renderer.config.ts',
|
|
|
|
|
},
|
|
|
|
|
],
|
|
|
|
|
}),
|
|
|
|
|
// Fuses are used to enable/disable various Electron functionality
|
|
|
|
|
// at package time, before code signing the application
|
|
|
|
|
new FusesPlugin({
|
|
|
|
|
version: FuseVersion.V1,
|
|
|
|
|
[FuseV1Options.RunAsNode]: false,
|
|
|
|
|
[FuseV1Options.EnableCookieEncryption]: true,
|
|
|
|
|
[FuseV1Options.EnableNodeOptionsEnvironmentVariable]: false,
|
|
|
|
|
[FuseV1Options.EnableNodeCliInspectArguments]: false,
|
|
|
|
|
[FuseV1Options.EnableEmbeddedAsarIntegrityValidation]: true,
|
|
|
|
|
[FuseV1Options.OnlyLoadAppFromAsar]: true,
|
|
|
|
|
}),
|
|
|
|
|
],
|
2024-11-17 18:56:49 +01:00
|
|
|
hooks: {
|
|
|
|
|
prePackage: async () => {
|
|
|
|
|
// This is a temporary fix to be able to package the app
|
|
|
|
|
// in a monorepo setup. When packaging the app, vite checks only in
|
|
|
|
|
// the node_modules directory of the current package for dependencies needed in the main process.
|
|
|
|
|
// This is why we need to copy the node_modules directory from the root to the build directory.
|
|
|
|
|
|
|
|
|
|
// to be removed when forge supports monorepos
|
|
|
|
|
|
|
|
|
|
const srcNodeModules = '../../node_modules';
|
|
|
|
|
const destNodeModules = './node_modules';
|
|
|
|
|
|
2024-11-22 11:24:56 +01:00
|
|
|
// First clear the node_modules directory
|
|
|
|
|
await fs.rm(destNodeModules, { recursive: true, force: true });
|
|
|
|
|
|
2024-11-17 18:56:49 +01:00
|
|
|
// Ensure the destination directory exists
|
|
|
|
|
await fs.mkdir(destNodeModules, { recursive: true });
|
|
|
|
|
|
|
|
|
|
// Copy the entire node_modules directory recursively
|
|
|
|
|
await fs.cp(srcNodeModules, destNodeModules, {
|
|
|
|
|
recursive: true,
|
|
|
|
|
force: true,
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
postPackage: async () => {
|
|
|
|
|
// remove the node_modules directory
|
|
|
|
|
await fs.rm('./node_modules', { recursive: true, force: true });
|
|
|
|
|
},
|
|
|
|
|
},
|
2024-11-16 16:55:45 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
export default config;
|