Repository navigation
Expand file tree
/
Copy pathelectron-builder.config.js
More file actions
144 lines (132 loc) · 5.99 KB
/
Copy pathelectron-builder.config.js
File metadata and controls
144 lines (132 loc) · 5.99 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
// electron-builder configuration.
// appId and productName are derived automatically from the package.json version:
// - version contains "-canary" → canary identifiers (separate install, separate userData)
// - plain semver (e.g. "2.0.0") → stable identifiers
// This means merging canary into master and bumping the version is all that is
// needed at graduation — no manual edits to this file required.
//
// IMPORTANT — stable appId continuity:
// v1.x releases shipped with no explicit appId, so electron-builder used its
// default: "com.electron.proxyscrape-proxy-checker". The stable v2 appId MUST
// match this so that:
// - Windows NSIS recognises the existing v1 install and upgrades it cleanly
// - macOS/Linux userData directories are the same path (settings + DB preserved)
// Do NOT change the stable appId without a cross-directory migration strategy.
const pkg = require('./package.json');
const isCanary = pkg.version.includes('-canary');
module.exports = {
appId: isCanary ? 'com.proxyscrape.checker.canary' : 'com.electron.proxyscrape-proxy-checker',
productName: isCanary ? 'ProxyScrape Proxy Checker Canary' : 'ProxyScrape Proxy Checker',
copyright: 'ProxyScrape',
// electron-builder respects .gitignore by default, which would exclude the
// `dist/` build output. An explicit files list overrides that behaviour so
// the renderer, main, and preload bundles are always included in the ASAR.
// The Go binaries are handled separately via extraResources and are never
// inside the ASAR, so they don't appear here.
// Register the app as the OS handler for proxychecker:// URLs.
// Used by the browser extension to open a specific proxy in the checker.
// A single scheme covers both stable and canary builds — whichever is
// installed last wins the OS registration, which is acceptable.
protocols: [
{
name: 'ProxyScrape Proxy Checker',
schemes: ['proxychecker'],
},
],
files: [
'dist/**',
'public/icons/**',
'package.json',
],
directories: {
output: 'release',
},
// Binaries and update metadata (.yml files) are hosted on Cloudflare R2,
// not as GitHub Release assets. GitHub Releases are created separately
// (see release.yml) and serve as the changelog/release notes only.
//
// Channel is derived from the version:
// 2.0.7 → stable → https://updates.proxyscrape.com/stable/ → latest.yml
// 2.0.8-canary → canary → https://updates.proxyscrape.com/canary/ → canary.yml
publish: [
{
provider: 'generic',
url: `${process.env.R2_PUBLIC_URL}/${isCanary ? 'canary' : 'stable'}`,
channel: isCanary ? 'canary' : 'latest',
// Cloudflare R2 does not support multipart byte-range requests, so the
// default multi-range differential downloader always fails with a 400 and
// falls back to a full installer download with no progress events. Setting
// this to false makes electron-updater use sequential single-range requests
// instead — R2 handles those correctly, differential downloads actually
// work, and download-progress events fire on Windows.
useMultipleRangeRequest: false,
},
],
mac: {
icon: './public/icons/icon.icns',
category: 'public.app-category.utilities',
artifactName: '${name}-v${version}-${arch}-${os}.${ext}',
hardenedRuntime: true,
gatekeeperAssess: false,
entitlements: 'build/entitlements.mac.plist',
entitlementsInherit: 'build/entitlements.mac.inherit.plist',
// 'binaries' explicitly signs these bundled executables with the Developer ID
// during the mac build step. Verified on v2.4.3-canary: all four binaries carry
// a valid Developer ID signature inside the distributed .app bundle.
binaries: [
'bin/checker-darwin-arm64',
'bin/checker-darwin-x64',
'bin/proxychecker-host-darwin-arm64',
'bin/proxychecker-host-darwin-x64',
],
extraResources: [
{ from: 'bin/checker-darwin-arm64', to: 'bin/checker-darwin-arm64' },
{ from: 'bin/checker-darwin-x64', to: 'bin/checker-darwin-x64' },
{ from: 'bin/proxychecker-host-darwin-arm64', to: 'bin/proxychecker-host-darwin-arm64' },
{ from: 'bin/proxychecker-host-darwin-x64', to: 'bin/proxychecker-host-darwin-x64' },
],
target: [
{ target: 'dmg', arch: ['x64', 'arm64'] },
{ target: 'zip', arch: ['x64', 'arm64'] },
],
},
afterSign: 'scripts/notarize.js',
win: {
icon: './public/icons/icon.ico',
artifactName: '${name}-v${version}-${arch}-${os}-installer.${ext}',
extraResources: [
{ from: 'bin/checker-win-x64.exe', to: 'bin/checker-win-x64.exe' },
{ from: 'bin/checker-win-arm64.exe', to: 'bin/checker-win-arm64.exe' },
{ from: 'bin/proxychecker-host-win-x64.exe', to: 'bin/proxychecker-host-win-x64.exe' },
{ from: 'bin/proxychecker-host-win-arm64.exe', to: 'bin/proxychecker-host-win-arm64.exe' },
],
target: [
{ target: 'nsis', arch: ['x64', 'arm64'] },
{ target: 'portable', arch: ['x64', 'arm64'] },
],
},
linux: {
icon: './public/icons/icon.png',
category: 'Network',
artifactName: '${name}-v${version}-${arch}-${os}.${ext}',
extraResources: [
{ from: 'bin/checker-linux-x64', to: 'bin/checker-linux-x64' },
{ from: 'bin/checker-linux-arm64', to: 'bin/checker-linux-arm64' },
{ from: 'bin/proxychecker-host-linux-x64', to: 'bin/proxychecker-host-linux-x64' },
{ from: 'bin/proxychecker-host-linux-arm64', to: 'bin/proxychecker-host-linux-arm64' },
],
target: [
{ target: 'AppImage', arch: ['x64', 'arm64'] },
],
},
nsis: {
oneClick: false,
perMachine: true,
allowToChangeInstallationDirectory: true,
buildUniversalInstaller: false,
include: 'build/uninstall.nsh',
},
portable: {
artifactName: '${name}-v${version}-${arch}-${os}-portable.${ext}',
},
};