-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathforge.config.ts
More file actions
148 lines (144 loc) · 6.06 KB
/
forge.config.ts
File metadata and controls
148 lines (144 loc) · 6.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
import type { ForgeConfig } from '@electron-forge/shared-types';
import { MakerSquirrel } from '@electron-forge/maker-squirrel';
import { MakerZIP } from '@electron-forge/maker-zip';
import { MakerDeb } from '@electron-forge/maker-deb';
import { MakerRpm } from '@electron-forge/maker-rpm';
import { MakerAppX } from '@electron-forge/maker-appx';
import { MakerDMG } from '@electron-forge/maker-dmg';
import { VitePlugin } from '@electron-forge/plugin-vite';
import { FusesPlugin } from '@electron-forge/plugin-fuses';
import { FuseV1Options, FuseVersion } from '@electron/fuses';
// Determine if this is a Mac App Store build
// Check both environment variable and command line argument
const isMAS = process.env.MAS_BUILD === 'true' || process.argv.includes('--platform=mas');
const config: ForgeConfig = {
packagerConfig: {
asar: true,
name: 'Compose Booster',
executableName: 'Compose Booster',
// Platform-specific icons
icon: process.platform === 'darwin'
? './assets/icons/mac/icon'
: './assets/icons/win/icon',
// macOS specific configuration
appBundleId: 'com.coldray.compose-booster',
appCategoryType: 'public.app-category.productivity',
// Extend Info.plist with additional keys
extendInfo: {
// Declare no custom encryption (only uses OS-provided TLS/HTTPS)
// This avoids the export compliance prompt in App Store Connect
ITSAppUsesNonExemptEncryption: false,
// Minimum macOS version - required for ARM-only builds (no Intel)
LSMinimumSystemVersion: '12.0',
},
// Code signing for macOS (uses environment variables or keychain)
osxSign: process.platform === 'darwin' ? {
identity: isMAS
? 'Apple Distribution' // For Mac App Store
: 'Developer ID Application', // For GitHub distribution
'hardened-runtime': !isMAS, // Hardened runtime for notarization (not MAS)
strictVerify: false, // Skip pre-sign verification (Electron has adhoc signature)
provisioningProfile: isMAS ? './build/embedded.provisionprofile' : undefined,
// Use optionsForFile to specify entitlements - required for MAS builds
// The old top-level entitlements/entitlements-inherit properties are ignored by @electron/osx-sign
optionsForFile: (filePath: string) => {
// Main app bundle gets full entitlements, helper apps/frameworks get inherit entitlements
// The main app path ends with .app but doesn't contain .app/ (not nested inside another .app)
const isMainApp = filePath.endsWith('.app') && !filePath.includes('.app/');
if (isMAS) {
return {
entitlements: isMainApp
? './build/entitlements.mas.plist'
: './build/entitlements.mas.inherit.plist',
};
} else {
return {
entitlements: './build/entitlements.mac.plist',
};
}
},
} : undefined,
// Notarization for GitHub distribution (not MAS)
osxNotarize: (process.platform === 'darwin' && !isMAS) ? {
appleId: process.env.APPLE_ID || '',
appleIdPassword: process.env.APPLE_APP_PASSWORD || '',
teamId: 'NBW65ZYT36',
} : undefined,
},
buildIdentifier: process.arch,
rebuildConfig: {},
makers: [
new MakerSquirrel({
name: 'ComposeBooster', // Used for installation folder and registry entries (no spaces)
setupIcon: './assets/icons/win/icon.ico',
iconUrl: 'https://raw.githubusercontent.com/lestephen/compose-booster/master/assets/icons/win/icon.ico', // URL for auto-update (optional)
}),
new MakerAppX({
// Microsoft Store identity (from Partner Center)
identityName: 'ColdRayLabs.ComposeBooster',
publisher: 'CN=D41101CD-1A4E-4FB3-8255-4BA6A73D7D90',
publisherDisplayName: 'Cold Ray Labs',
// App metadata
applicationDescription: 'AI-powered email composition assistant - improve, polish, and customize your emails with advanced AI models',
backgroundColor: '#f18138', // Orange from logo
// Assets - use appx folder for APPX package tiles (separate from store display images)
assets: './assets/appx',
// Package settings
packageName: 'ComposeBooster',
packageDisplayName: 'Compose Booster',
packageVersion: '1.0.0.0', // Must be x.x.x.x format for Store
// For Store submission - don't sign with dev cert, produce unsigned package
makeVersionWinStoreCompatible: true,
devCert: undefined,
}),
new MakerZIP({}, ['darwin', 'mas']),
// DMG only for GitHub distribution (darwin), not for MAS
new MakerDMG({
name: 'Compose Booster',
icon: './assets/icons/mac/icon.icns',
format: 'ULFO', // ULFO = lzfse compression, good balance of size and compatibility
}),
new MakerRpm({}),
new MakerDeb({}),
],
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/preload.ts',
config: 'vite.preload.config.ts',
target: 'preload',
},
{
entry: 'src/preload/settingsPreload.ts',
config: 'vite.preload.config.ts',
target: 'preload',
},
],
renderer: [
{
name: 'main_window',
config: 'vite.renderer.config.ts',
},
],
}),
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;