forked from invoke-ai/launcher
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathelectron-builder.config.ts
More file actions
91 lines (80 loc) · 2.91 KB
/
electron-builder.config.ts
File metadata and controls
91 lines (80 loc) · 2.91 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
import type { Configuration, CustomWindowsSign, WindowsConfiguration } from 'electron-builder';
const getWindowsSigningOptions = (): Partial<WindowsConfiguration> => {
return {
signtoolOptions: {
// Delegate signing to our own script. This script is called once for each executable. The script contains
// logic to skip signing for executables that are not meant to be signed, such as the bundled uv binary.
sign: './scripts/customSign.js',
// We use a custom signing script to handle the signing process, so the selected algorithms are essentially
// placeholders. We only want to sign the executable once, so we select a single algo.
signingHashAlgorithms: ['sha256'],
},
};
};
export default {
appId: 'com.invoke.invoke-community-edition',
productName: 'Invoke Community Edition',
directories: {
output: 'dist',
},
files: ['package.json', 'out/**/*', 'node_modules/node-pty/**/*'],
extraResources: [
{
from: 'assets/bin',
to: './bin',
filter: 'uv*',
},
],
win: {
target: ['nsis'],
...getWindowsSigningOptions(),
forceCodeSigning: true,
},
linux: {
target: ['AppImage'],
},
publish: {
provider: 'github',
owner: 'invoke-ai',
repo: 'launcher',
},
electronFuses: {
runAsNode: false,
enableCookieEncryption: true,
enableNodeOptionsEnvironmentVariable: false,
enableNodeCliInspectArguments: false,
enableEmbeddedAsarIntegrityValidation: true,
onlyLoadAppFromAsar: true,
resetAdHocDarwinSignature: true,
},
electronUpdaterCompatibility: '>= 2.16',
afterAllArtifactBuild: (buildResult) => {
const fs = require('fs');
const path = require('path');
const packageJson = JSON.parse(fs.readFileSync(path.join(process.cwd(), 'package.json'), 'utf8'));
const version = packageJson.version;
const outDir = buildResult.outDir;
const newArtifactPaths = [...buildResult.artifactPaths];
console.log('Creating "latest" versions of artifacts...');
for (const artifactPath of buildResult.artifactPaths) {
const fileName = path.basename(artifactPath);
// Skip files that don't contain the version number
if (!fileName.includes(version)) {
continue;
}
// Create the "latest" filename by replacing the version with "latest"
const latestFileName = fileName.replace(version, 'latest');
const latestPath = path.join(outDir, latestFileName);
try {
// Copy the file with the new name
fs.copyFileSync(artifactPath, latestPath);
console.log(`Created: ${latestFileName}`);
// Add the new file to the artifacts list so it gets uploaded
newArtifactPaths.push(latestPath);
} catch (error) {
console.error(`Failed to create ${latestFileName}:`, error);
}
}
return newArtifactPaths;
},
} satisfies Configuration;