forked from nkzw-tech/codiff
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathforge.config.cjs
More file actions
150 lines (145 loc) · 4.33 KB
/
Copy pathforge.config.cjs
File metadata and controls
150 lines (145 loc) · 4.33 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
149
150
// @ts-check
/* eslint-disable @typescript-eslint/no-require-imports, no-undef */
const { existsSync } = require('node:fs');
const { join } = require('node:path');
const electronCachePath = process.env.ELECTRON_CACHE || join(__dirname, '.cache/electron');
const entitlementsPath = join(__dirname, 'electron/entitlements.plist');
const iconPath = existsSync(join(__dirname, 'electron/icons/icon.icns'))
? './electron/icons/icon'
: undefined;
const macIconAssetName = 'Icon';
const macAssetCatalogPath = existsSync(join(__dirname, 'electron/icons/Assets.car'))
? './electron/icons/Assets.car'
: undefined;
const linuxIconPath = './electron/icons/icon.png';
const windowsIconPath = './electron/icons/icon.ico';
const skipSquirrel = process.env.CODIFF_SKIP_SQUIRREL === '1';
const osxNotarize =
process.env.APPLE_ID && process.env.APPLE_PASSWORD && process.env.APPLE_TEAM_ID
? {
appleId: process.env.APPLE_ID,
appleIdPassword: process.env.APPLE_PASSWORD,
teamId: process.env.APPLE_TEAM_ID,
tool: 'notarytool',
}
: undefined;
/**
* @typedef {import('@electron-forge/shared-types').ForgeArch} ForgeArch
* @typedef {import('@electron-forge/shared-types').ForgeConfig} ForgeConfig
* @typedef {import('@electron-forge/shared-types').ForgePlatform} ForgePlatform
* @typedef {Omit<import('@electron-forge/shared-types').ForgePackagerOptions, 'osxNotarize' | 'osxSign'> & {
* osxNotarize?: Record<string, unknown>;
* osxSign?: Record<string, unknown>;
* }} CodiffPackagerConfig
* @typedef {{
* arch?: Array<ForgeArch>;
* config?: Record<string, unknown>;
* enabled?: boolean;
* name: string;
* platforms?: Array<ForgePlatform> | null;
* }} CodiffMakerConfig
* @typedef {Omit<ForgeConfig, 'makers' | 'packagerConfig'> & {
* makers: Array<CodiffMakerConfig>;
* packagerConfig: CodiffPackagerConfig;
* }} CodiffForgeConfig
*/
/** @type {CodiffForgeConfig} */
module.exports = {
hooks: {
prePackage: async (forgeConfig, platform) => {
if (platform !== 'darwin' || !macAssetCatalogPath) {
return;
}
forgeConfig.packagerConfig.extendInfo = {
...(typeof forgeConfig.packagerConfig.extendInfo === 'object'
? forgeConfig.packagerConfig.extendInfo
: {}),
CFBundleIconName: macIconAssetName,
};
const extraResource = forgeConfig.packagerConfig.extraResource;
forgeConfig.packagerConfig.extraResource = [
...(Array.isArray(extraResource) ? extraResource : extraResource ? [extraResource] : []),
macAssetCatalogPath,
];
},
},
makers: [
{
config: {
setupIcon: windowsIconPath,
},
enabled: !skipSquirrel,
name: '@electron-forge/maker-squirrel',
},
{
arch: ['arm64'],
name: '@electron-forge/maker-zip',
platforms: ['darwin'],
},
{
name: '@electron-forge/maker-zip',
platforms: ['win32'],
},
{
config: {
icon: linuxIconPath,
},
name: '@electron-forge/maker-deb',
},
{
config: {
icon: linuxIconPath,
},
name: '@electron-forge/maker-rpm',
},
],
packagerConfig: {
appBundleId: 'dev.nkzw-tech.codiff',
appCopyright: 'Copyright (c) 2026-current Nakazawa Tech',
asar: false,
download: {
cacheRoot: electronCachePath,
},
executableName: 'codiff',
...(iconPath ? { icon: iconPath } : {}),
ignore: [
/^\/\.DS_Store$/,
/^\/\.cache(?:$|\/)/,
/^\/\.enum_manifest\.json$/,
/^\/\.env(?:$|[.])/,
/^\/\.git(?:$|\/)/,
/^\/\.gitignore$/,
/^\/\.github(?:$|\/)/,
/^\/\.vite-hooks(?:$|\/)/,
/^\/\.vscode(?:$|\/)/,
/^\/README\.md$/,
/^\/coverage(?:$|\/)/,
/^\/docs(?:$|\/)/,
/^\/forge\.config\.cjs$/,
/^\/index\.html$/,
/^\/out(?:$|\/)/,
/^\/pnpm-workspace\.yaml$/,
/^\/public(?:$|\/)/,
/^\/core(?:$|\/)/,
/^\/tsconfig/,
/^\/vite\.config\./,
],
name: 'Codiff',
...(osxNotarize ? { osxNotarize } : {}),
osxSign: {
continueOnError: false,
hardenedRuntime: true,
identity: process.env.APPLE_SIGNING_IDENTITY,
optionsForFile: () => ({
entitlements: entitlementsPath,
}),
},
protocols: [
{
name: 'Codiff',
schemes: ['codiff'],
},
],
},
rebuildConfig: {},
};