Improve Electron experience and build system

This commit is contained in:
2025-09-19 22:10:31 +03:00
Unverified
parent 89492b2f8c
commit a580b87e1c
17 changed files with 197 additions and 146 deletions
-48
View File
@@ -1,48 +0,0 @@
import { FusesPlugin } from '@electron-forge/plugin-fuses';
import { FuseV1Options, FuseVersion } from '@electron/fuses';
import type { ForgeConfig } from "@electron-forge/shared-types";
const config: ForgeConfig = {
packagerConfig: {
asar: true
},
rebuildConfig: {},
makers: [
{
name: '@electron-forge/maker-squirrel',
config: {},
},
{
name: '@electron-forge/maker-zip',
config: {},
platforms: ['darwin'],
},
{
name: '@electron-forge/maker-deb',
config: {},
},
{
name: '@electron-forge/maker-rpm',
config: {},
},
],
plugins: [
{
name: '@electron-forge/plugin-auto-unpack-natives',
config: {},
},
// 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,
}),
],
};
export default config;
-33
View File
@@ -1,33 +0,0 @@
{
"name": "FromChat",
"productName": "FromChat",
"version": "1.0.0",
"description": "A 100% Open Source Messenger",
"main": "dist-electron/main.js",
"scripts": {
"package": "electron-forge package",
"make": "electron-forge make",
"publish": "electron-forge publish"
},
"keywords": [],
"author": {
"name": "denis0001-dev",
"email": "denis0001.dev@ya.ru"
},
"license": "GPL-2.0",
"devDependencies": {
"@electron-forge/cli": "^7.8.3",
"@electron-forge/maker-deb": "^7.8.3",
"@electron-forge/maker-rpm": "^7.8.3",
"@electron-forge/maker-squirrel": "^7.8.3",
"@electron-forge/maker-zip": "^7.8.3",
"@electron-forge/plugin-auto-unpack-natives": "^7.8.3",
"@electron-forge/plugin-fuses": "^7.8.3",
"@electron/fuses": "^1.8.0",
"electron": "37.3.1",
"vite": "^5.4.19"
},
"dependencies": {
"electron-squirrel-startup": "^1.0.1"
}
}
+4 -4
View File
@@ -4,7 +4,7 @@ import path from "node:path";
app.whenReady().then(() => {
const win = new BrowserWindow({
title: 'Main window',
minWidth: 650,
minWidth: 800,
minHeight: 420,
webPreferences: {
preload: path.join(import.meta.dirname, "preload.mjs")
@@ -16,11 +16,11 @@ app.whenReady().then(() => {
y: 16 - 4
},
titleBarOverlay: process.platform !== "darwin"
})
});
if (process.env.VITE_DEV_SERVER_URL) {
win.loadURL(process.env.VITE_DEV_SERVER_URL)
win.loadURL(process.env.VITE_DEV_SERVER_URL);
} else {
win.loadFile('dist/index.html');
win.loadFile('frontend/build/electron/dist/index.html');
}
});