2025-05-27 02:43:34 +02:00
|
|
|
import { Arch, build, Platform } from 'electron-builder'
|
|
|
|
import config from './ebuilder.config.mjs'
|
2020-02-16 13:30:00 -05:00
|
|
|
|
2020-07-21 17:43:52 -04:00
|
|
|
const args = process.argv
|
2020-02-16 13:30:00 -05:00
|
|
|
|
2025-02-10 19:40:22 -05:00
|
|
|
/** @type {Map<import('electron-builder').Platform, Map<import('electron-builder').Arch, Array<string>>>} */
|
2020-02-16 13:30:00 -05:00
|
|
|
let targets
|
2025-05-27 02:43:34 +02:00
|
|
|
const platform = process.platform
|
2020-02-16 13:30:00 -05:00
|
|
|
|
2022-05-15 00:53:08 +08:00
|
|
|
if (platform === 'darwin') {
|
|
|
|
let arch = Arch.x64
|
|
|
|
|
2022-09-07 02:48:29 +05:30
|
|
|
if (args[2] === 'arm64') {
|
2022-05-15 00:53:08 +08:00
|
|
|
arch = Arch.arm64
|
|
|
|
}
|
2022-09-26 22:17:04 +02:00
|
|
|
|
2024-10-27 16:08:50 +01:00
|
|
|
targets = Platform.MAC.createTarget(['DMG', 'zip', '7z'], arch)
|
2022-05-15 00:53:08 +08:00
|
|
|
} else if (platform === 'win32') {
|
2022-09-07 02:48:29 +05:30
|
|
|
let arch = Arch.x64
|
|
|
|
|
|
|
|
if (args[2] === 'arm64') {
|
|
|
|
arch = Arch.arm64
|
|
|
|
}
|
2022-09-26 22:17:04 +02:00
|
|
|
|
2022-09-10 16:24:22 +02:00
|
|
|
targets = Platform.WINDOWS.createTarget(['nsis', 'zip', '7z', 'portable'], arch)
|
2022-05-15 00:53:08 +08:00
|
|
|
} else if (platform === 'linux') {
|
2020-07-21 17:43:52 -04:00
|
|
|
let arch = Arch.x64
|
|
|
|
|
2021-03-06 11:19:54 -05:00
|
|
|
if (args[2] === 'arm64') {
|
2020-07-21 17:43:52 -04:00
|
|
|
arch = Arch.arm64
|
|
|
|
}
|
|
|
|
|
2021-04-22 01:11:52 +03:00
|
|
|
if (args[2] === 'arm32') {
|
2021-03-06 11:19:54 -05:00
|
|
|
arch = Arch.armv7l
|
|
|
|
}
|
|
|
|
|
2025-04-01 04:21:41 +02:00
|
|
|
targets = Platform.LINUX.createTarget(['deb', 'zip', '7z', 'rpm', 'AppImage', 'pacman'], arch)
|
2020-02-16 13:30:00 -05:00
|
|
|
}
|
|
|
|
|
2025-05-27 02:43:34 +02:00
|
|
|
try {
|
|
|
|
const output = await build({ targets, config, publish: 'never' })
|
|
|
|
console.log(output)
|
|
|
|
} catch (error) {
|
|
|
|
console.error(error)
|
|
|
|
}
|