-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathelectron-builder.ts
More file actions
116 lines (109 loc) · 3.2 KB
/
Copy pathelectron-builder.ts
File metadata and controls
116 lines (109 loc) · 3.2 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
import path from "node:path";
import {$} from "zx";
import type {Configuration} from "electron-builder";
const appId = "node-llama-cpp.electron.example";
const productName = "node-llama-cpp Electron example";
const executableName = "node-llama-cpp-electron-example";
const appxIdentityName = "node.llama.cpp.electron.example";
/**
* @see - https://www.electron.build/configuration/configuration
*/
export default {
appId: appId,
asar: true,
productName: productName,
executableName: executableName,
directories: {
output: "release"
},
icon: "./public/app-icon.png",
// remove this once you set up your own code signing for macOS
async afterPack(context) {
if (context.electronPlatformName === "darwin") {
// check whether the app was already signed
const appPath = path.join(context.appOutDir, `${context.packager.appInfo.productFilename}.app`);
// this is needed for the app to not appear as "damaged" on Apple Silicon Macs
// https://github.com/electron-userland/electron-builder/issues/5850#issuecomment-1821648559
await $`codesign --force --deep --sign - ${appPath}`;
}
},
files: [
"dist",
"dist-electron",
"!node_modules/node-llama-cpp/bins/**/*",
"node_modules/node-llama-cpp/bins/${os}-${arch}*/**/*",
"!node_modules/node-llama-cpp/llama/localBuilds/**/*",
"node_modules/node-llama-cpp/llama/localBuilds/${os}-${arch}*/**/*",
"!node_modules/@node-llama-cpp/*/bins/**/*",
"node_modules/@node-llama-cpp/${os}-${arch}*/bins/**/*"
],
asarUnpack: [
"node_modules/node-llama-cpp/bins",
"node_modules/node-llama-cpp/llama/localBuilds",
"node_modules/@node-llama-cpp/*"
],
mac: {
target: [{
target: "dmg",
arch: [
"arm64",
"x64"
]
}, {
target: "zip",
arch: [
"arm64",
"x64"
]
}],
artifactName: "${name}.macOS.${version}.${arch}.${ext}"
},
win: {
target: [{
target: "nsis",
arch: [
"x64",
"arm64"
]
}],
artifactName: "${name}.Windows.${version}.${arch}.${ext}"
},
appx: {
identityName: appxIdentityName,
artifactName: "${name}.Windows.${version}.${arch}.${ext}"
},
nsis: {
oneClick: true,
perMachine: false,
allowToChangeInstallationDirectory: false,
deleteAppDataOnUninstall: true
},
linux: {
target: [{
target: "AppImage",
arch: [
"x64",
"arm64"
]
}, {
target: "snap",
arch: [
"x64"
]
}, {
target: "deb",
arch: [
"x64",
"arm64"
]
}, {
target: "tar.gz",
arch: [
"x64",
"arm64"
]
}],
category: "Utility",
artifactName: "${name}.Linux.${version}.${arch}.${ext}"
}
} as Configuration;