goose/ui/desktop/forge.config.ts

128 lines
3.3 KiB
TypeScript

const { FusesPlugin } = require('@electron-forge/plugin-fuses');
const { FuseV1Options, FuseVersion } = require('@electron/fuses');
const { resolve } = require('path');
let cfg = {
asar: true,
extraResource: ['src/bin', 'src/images'],
icon: 'src/images/icon',
// Windows specific configuration
win32: {
icon: 'src/images/icon.ico',
certificateFile: process.env.WINDOWS_CERTIFICATE_FILE,
signingRole: process.env.WINDOW_SIGNING_ROLE,
rfc3161TimeStampServer: 'http://timestamp.digicert.com',
signWithParams: '/fd sha256 /tr http://timestamp.digicert.com /td sha256',
},
// Protocol registration
protocols: [
{
name: 'GooseProtocol',
schemes: ['goose'],
},
],
// macOS Info.plist extensions for drag-and-drop support
extendInfo: {
// Document types for drag-and-drop support onto dock icon
CFBundleDocumentTypes: [
{
CFBundleTypeName: "Folders",
CFBundleTypeRole: "Viewer",
LSHandlerRank: "Alternate",
LSItemContentTypes: ["public.directory", "public.folder"]
}
]
},
};
module.exports = {
packagerConfig: cfg,
rebuildConfig: {},
publishers: [
{
name: '@electron-forge/publisher-github',
config: {
repository: {
owner: 'block',
name: 'goose',
},
prerelease: false,
draft: true,
},
},
],
makers: [
{
name: '@electron-forge/maker-zip',
platforms: ['darwin', 'win32', 'linux'],
config: {
arch: process.env.ELECTRON_ARCH === 'x64' ? ['x64'] : ['arm64'],
options: {
icon: 'src/images/icon.ico',
},
},
},
{
name: '@electron-forge/maker-deb',
config: {
name: 'Goose',
bin: 'Goose',
maintainer: 'Block, Inc.',
homepage: 'https://block.github.io/goose/',
categories: ['Development'],
desktopTemplate: './forge.deb.desktop',
options: {
icon: 'src/images/icon.png'
}
},
},
{
name: '@electron-forge/maker-rpm',
config: {
name: 'Goose',
bin: 'Goose',
maintainer: 'Block, Inc.',
homepage: 'https://block.github.io/goose/',
categories: ['Development'],
desktopTemplate: './forge.rpm.desktop',
options: {
icon: 'src/images/icon.png'
}
},
},
],
plugins: [
{
name: '@electron-forge/plugin-vite',
config: {
build: [
{
entry: 'src/main.ts',
config: 'vite.main.config.mts',
},
{
entry: 'src/preload.ts',
config: 'vite.preload.config.mts',
},
],
renderer: [
{
name: 'main_window',
config: 'vite.renderer.config.mts',
},
],
},
},
// 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,
}),
],
};