Skip to content

Commit bf23deb

Browse files
committed
Optimized script, simplified builder config
- Optimized build.mjs as to electron-vite/electron-vite-react@11d46ee - Simplified electron-builder config
1 parent 0068fb5 commit bf23deb

2 files changed

Lines changed: 30 additions & 55 deletions

File tree

.electron-builder.config.js

Lines changed: 16 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -5,54 +5,40 @@
55
module.exports = {
66
appId: 'com.paxanddos.lucast',
77
productName: 'Lucast',
8-
copyright: 'Copyright © 2022 ${author}',
98
asar: true,
10-
directories: {
11-
output: 'release/${version}',
12-
buildResources: 'build',
13-
},
9+
copyright: 'Copyright © 2022 ${author}',
10+
directories: { buildResources: 'build', output: 'release/${version}' },
1411
files: ['dist'],
15-
win: {
16-
target: [
17-
{
18-
target: 'nsis',
19-
arch: ['x64'],
20-
},
21-
],
22-
},
12+
win: { target: [{ arch: ['x64'], target: 'nsis' }] },
2313
nsis: {
24-
oneClick: false,
25-
perMachine: false,
2614
allowToChangeInstallationDirectory: true,
27-
deleteAppDataOnUninstall: false,
2815
artifactName: '${productName}-Setup.${ext}',
2916
createDesktopShortcut: true,
3017
createStartMenuShortcut: true,
18+
deleteAppDataOnUninstall: false,
19+
oneClick: false,
20+
perMachine: false,
3121
runAfterFinish: true,
22+
uninstallDisplayName: '${productName}',
3223
},
3324
mac: {
34-
identity: 'PAXANDDOS Individual Co.',
25+
category: 'public.app-category.utilities',
26+
electronLanguages: ['en'],
3527
extendInfo: {
36-
ElectronTeamID: 'paxanddos',
37-
'com.apple.developer.team-identifier': 'paxanddos',
38-
'com.apple.application-identifier': 'paxanddos.github.io',
3928
'Bundle name': '${productName}',
29+
'com.apple.application-identifier': 'paxanddos.github.io',
30+
'com.apple.developer.team-identifier': 'paxanddos',
31+
ElectronTeamID: 'paxanddos',
4032
LSHasLocalizedDisplayName: true,
4133
},
42-
electronLanguages: ['en'],
34+
identity: 'PAXANDDOS Individual Co.',
4335
target: ['dmg'],
44-
category: 'public.app-category.utilities',
4536
},
4637
dmg: {
4738
artifactName: '${productName}-Installer.${ext}',
48-
title: '${productName} ${version}',
4939
sign: false,
40+
title: '${productName} ${version}',
5041
},
51-
linux: {
52-
target: ['AppImage'],
53-
category: 'Utility',
54-
},
55-
appImage: {
56-
artifactName: '${productName}-Installer.${ext}',
57-
},
42+
linux: { category: 'Utility', target: ['AppImage'] },
43+
appImage: { artifactName: '${productName}-Installer.${ext}' },
5844
}

scripts/build.mjs

Lines changed: 14 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -6,31 +6,20 @@ import { build } from 'vite'
66

77
const __dirname = dirname(fileURLToPath(import.meta.url))
88

9-
/**
10-
* @type {Record<string, import('vite').InlineConfig>}
11-
*/
12-
const viteConfigs = {
13-
main: {
14-
configFile: 'scripts/vite.config.mjs',
15-
root: join(__dirname, '../packages/main'),
16-
build: {
17-
outDir: '../../dist/main',
18-
},
9+
await build({
10+
configFile: 'scripts/vite.config.mjs',
11+
root: join(__dirname, '../packages/main'),
12+
build: {
13+
outDir: '../../dist/main',
1914
},
20-
preload: {
21-
configFile: 'scripts/vite.config.mjs',
22-
root: join(__dirname, '../packages/preload'),
23-
build: {
24-
outDir: '../../dist/preload',
25-
},
26-
},
27-
renderer: {
28-
configFile: 'packages/renderer/vite.config.ts',
29-
},
30-
}
15+
})
3116

32-
const buildElectron = async () => {
33-
for (const [, config] of Object.entries(viteConfigs)) await build(config)
34-
}
17+
await build({
18+
configFile: 'scripts/vite.config.mjs',
19+
root: join(__dirname, '../packages/preload'),
20+
build: {
21+
outDir: '../../dist/preload',
22+
},
23+
})
3524

36-
await buildElectron()
25+
await build({ configFile: 'packages/renderer/vite.config.ts' })

0 commit comments

Comments
 (0)