-
Notifications
You must be signed in to change notification settings - Fork 217
/
electron-builder.config.cjs
131 lines (127 loc) · 5.11 KB
/
electron-builder.config.cjs
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
const { Arch } = require("electron-builder");
const pkg = require("./package.json");
const fs = require("fs");
const path = require("path");
const windowsShouldSign = !!process.env.SM_CODE_SIGNING_CERT_SHA1_HASH;
/**
* @type {import('electron-builder').Configuration}
* @see https://www.electron.build/configuration/configuration
*/
const config = {
appId: pkg.build.appId,
productName: pkg.productName,
executableName: pkg.productName,
artifactName: "${productName}-${platform}-${arch}-${version}.${ext}",
generateUpdatesFilesForAllChannels: true,
npmRebuild: false,
nodeGypRebuild: false,
electronCompile: false,
files: [
{
from: "./dist",
to: "./dist",
filter: ["**/*", "!bin/*", "bin/wavesrv.${arch}*", "bin/wsh*"],
},
{
from: ".",
to: ".",
filter: ["package.json"],
},
"!node_modules", // We don't need electron-builder to package in Node modules as Vite has already bundled any code that our program is using.
],
directories: {
output: "make",
},
asarUnpack: [
"dist/bin/**/*", // wavesrv and wsh binaries
"dist/docsite/**/*", // the static docsite
],
mac: {
target: [
{
target: "zip",
arch: ["universal", "arm64", "x64"],
},
{
target: "dmg",
arch: ["universal", "arm64", "x64"],
},
],
category: "public.app-category.developer-tools",
minimumSystemVersion: "10.15.0",
mergeASARs: true,
singleArchFiles: "dist/bin/wavesrv.*",
entitlements: "build/entitlements.mac.plist",
entitlementsInherit: "build/entitlements.mac.plist",
extendInfo: {
NSContactsUsageDescription: "A CLI application running in Wave wants to use your contacts.",
NSRemindersUsageDescription: "A CLI application running in Wave wants to use your reminders.",
NSLocationWhenInUseUsageDescription:
"A CLI application running in Wave wants to use your location information while active.",
NSLocationAlwaysUsageDescription:
"A CLI application running in Wave wants to use your location information, even in the background.",
NSCameraUsageDescription: "A CLI application running in Wave wants to use the camera.",
NSMicrophoneUsageDescription: "A CLI application running in Wave wants to use your microphone.",
NSCalendarsUsageDescription: "A CLI application running in Wave wants to use Calendar data.",
NSLocationUsageDescription: "A CLI application running in Wave wants to use your location information.",
NSAppleEventsUsageDescription: "A CLI application running in Wave wants to use AppleScript.",
},
},
linux: {
artifactName: "${name}-${platform}-${arch}-${version}.${ext}",
category: "TerminalEmulator",
executableName: pkg.name,
target: ["zip", "deb", "rpm", "snap", "AppImage", "pacman"],
synopsis: pkg.description,
description: null,
desktop: {
Name: pkg.productName,
Comment: pkg.description,
Keywords: "developer;terminal;emulator;",
category: "Development;Utility;",
},
executableArgs: ["--enable-features", "UseOzonePlatform", "--ozone-platform-hint", "auto"], // Hint Electron to use Ozone abstraction layer for native Wayland support
},
deb: {
afterInstall: "build/deb-postinstall.tpl",
},
win: {
target: ["nsis", "msi", "zip"],
signtoolOptions: windowsShouldSign && {
signingHashAlgorithms: ["sha256"],
publisherName: "Command Line Inc",
certificateSubjectName: "Command Line Inc",
certificateSha1: process.env.SM_CODE_SIGNING_CERT_SHA1_HASH,
},
},
appImage: {
license: "LICENSE",
},
snap: {
base: "core22",
confinement: "classic",
allowNativeWayland: true,
artifactName: "${name}_${version}_${arch}.${ext}",
},
publish: {
provider: "generic",
url: "https://dl.waveterm.dev/releases-w2",
},
afterPack: (context) => {
// This is a workaround to restore file permissions to the wavesrv binaries on macOS after packaging the universal binary.
if (context.electronPlatformName === "darwin" && context.arch === Arch.universal) {
const packageBinDir = path.resolve(
context.appOutDir,
`${pkg.productName}.app/Contents/Resources/app.asar.unpacked/dist/bin`
);
// Reapply file permissions to the wavesrv binaries in the final app package
fs.readdirSync(packageBinDir, {
recursive: true,
withFileTypes: true,
})
.filter((f) => f.isFile() && f.name.startsWith("wavesrv"))
.forEach((f) => fs.chmodSync(path.resolve(f.parentPath ?? f.path, f.name), 0o755)); // 0o755 corresponds to -rwxr-xr-x
}
},
};
module.exports = config;