TidGi-Desktop/forge.config.ts
lin onetwo 0e96d94809
Fix/start error (#654)
* fix: lint

* chore: upgrade electron-ipc-cat to add try catch but useless

IPC Server: Sending response {
channel: 'ContextChannel',
request: { type: 'apply', propKey: 'get', args: [ 'supportedLanguagesMap' ] },
correlationId: '0.36061460136077916',
result: {}
}
Error sending from webFrameMain: Error: Failed to serialize arguments
at WebFrameMain.s.send (node:electron/js2c/browser_init:2:94282)
at WebContents.b.send (node:electron/js2c/browser_init:2:78703)
at I:\github\TidGi-Desktop.vite\build\main-BW_u7Pqi.js:39200:28

IPC Server: Sending response {
channel: 'ContextChannel',
request: { type: 'apply', propKey: 'get', args: [ 'supportedLanguagesMap' ] },
correlationId: '0.7064988939670734',
result: {}
}
Error sending from webFrameMain: Error: Failed to serialize arguments
at WebFrameMain.s.send (node:electron/js2c/browser_init:2:94282)
at WebContents.b.send (node:electron/js2c/browser_init:2:78703)
at I:\github\TidGi-Desktop.vite\build\main-BW_u7Pqi.js:39200:28

Proxy 对象不能被序列化

* fix: process.resourcesPath changes during app initialization, need to wait for it when start with scheme

* fix: Realign workspace view when reopening window to ensure browser view is properly positioned

fixes #626

* feat: api for git-sync-js to get deleted files

* fix: wikiWorker  methods should be async

* log debug not info

* fix: database should init frist before i18n

* fix: better error log when workspace config error

* chore: add maker-msix for windows

* fix: window.meta is not a function when view on browser

* feat: add more git services

* fix: discard file content cause lots of logs

fixes #653

* Update wiki

* test: Git Log window auto-refreshes when files change (only when window is open)

* test: use test id to wait and make test id debug log

* update i18n

* i18n

* lint

* Update test.yml

* Update test.yml

* Update index.tsx
2025-11-20 17:17:11 +08:00

124 lines
3.7 KiB
TypeScript

import { AutoUnpackNativesPlugin } from '@electron-forge/plugin-auto-unpack-natives';
import { VitePlugin } from '@electron-forge/plugin-vite';
import type { ForgeConfig } from '@electron-forge/shared-types';
import { readJsonSync } from 'fs-extra';
import path from 'path';
import afterPack from './scripts/afterPack';
import beforeAsar from './scripts/beforeAsar';
const packageJson = readJsonSync(path.join(__dirname, 'package.json')) as { description: string };
const supportedLanguages = readJsonSync(path.join(__dirname, 'localization', 'supportedLanguages.json')) as Record<string, string>;
const { description } = packageJson;
// Get list of supported language codes from centralized config
const supportedLanguageCodes = Object.keys(supportedLanguages);
const config: ForgeConfig = {
packagerConfig: {
name: 'TidGi',
executableName: 'tidgi',
win32metadata: {
CompanyName: 'TiddlyWiki Community',
OriginalFilename: 'TidGi Desktop',
},
protocols: [
{
name: 'TidGi Launch Protocol',
schemes: ['tidgi'],
},
],
icon: 'build-resources/icon.ico',
asar: {
// Unpack worker files, native modules path, and ALL .node binaries (including better-sqlite3)
unpack: '{**/.webpack/main/*.worker.*,**/.webpack/main/native_modules/path.txt,**/{.**,**}/**/*.node}',
},
extraResource: ['localization', 'template/wiki', 'build-resources/tidgiMiniWindow@2x.png', 'build-resources/tidgiMiniWindowTemplate@2x.png'],
// @ts-expect-error - mac config is valid
mac: {
category: 'productivity',
target: 'dmg',
icon: 'build-resources/icon.icns',
electronLanguages: supportedLanguageCodes,
},
appBundleId: 'com.tidgi',
afterPrune: [afterPack],
beforeAsar: [beforeAsar],
},
makers: [
{
name: '@electron-forge/maker-squirrel',
platforms: ['win32'],
config: (arch: string) => {
return {
setupExe: `Install-TidGi-Windows-${arch}.exe`,
setupIcon: 'build-resources/icon-installer.ico',
description,
iconUrl: 'https://raw.githubusercontent.com/tiddly-gittly/TidGi-Desktop/master/build-resources/icon%405x.png',
};
},
},
{
name: '@electron-forge/maker-msix',
platforms: ['win32'],
config: {
packageAssets: 'build-resources/icon.ico',
sign: false,
manifestVariables: {
publisher: 'CN=TiddlyWiki Community',
},
},
},
{
name: '@electron-forge/maker-zip',
platforms: ['darwin'],
config: {},
},
{
name: '@electron-forge/maker-deb',
platforms: ['linux'],
config: {
options: {
maintainer: 'Lin Onetwo <linonetwo012@gmail.com>',
mimeType: ['x-scheme-handler/tidgi'],
},
},
},
{
name: '@electron-forge/maker-rpm',
platforms: ['linux'],
config: {
options: {
maintainer: 'Lin Onetwo <linonetwo012@gmail.com>',
mimeType: ['x-scheme-handler/tidgi'],
},
},
},
],
plugins: [
new AutoUnpackNativesPlugin({}),
new VitePlugin({
// `build` can specify multiple entry builds, which can be Main process, Preload scripts, Worker process, etc.
build: [
{
// `entry` is 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/index.ts',
config: 'vite.preload.config.ts',
target: 'preload',
},
],
renderer: [
{
name: 'main_window',
config: 'vite.renderer.config.ts',
},
],
}),
],
};
export default config;