2020-02-16 13:30:00 -05:00
|
|
|
const os = require('os')
|
|
|
|
const builder = require('electron-builder')
|
2023-12-09 02:50:51 +01:00
|
|
|
const config = require('./ebuilder.config.js')
|
2020-02-16 13:30:00 -05:00
|
|
|
|
|
|
|
const Platform = builder.Platform
|
2020-07-21 17:43:52 -04:00
|
|
|
const Arch = builder.Arch
|
|
|
|
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
|
2022-05-15 00:53:08 +08:00
|
|
|
const platform = os.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
|
|
|
|
}
|
|
|
|
|
2022-09-10 16:24:22 +02:00
|
|
|
targets = Platform.LINUX.createTarget(['deb', 'zip', '7z', 'apk', 'rpm', 'AppImage', 'pacman'], arch)
|
2020-02-16 13:30:00 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
builder
|
|
|
|
.build({
|
|
|
|
targets,
|
|
|
|
config,
|
2022-08-12 02:35:26 +02:00
|
|
|
publish: 'never'
|
2020-02-16 13:30:00 -05:00
|
|
|
})
|
|
|
|
.then(m => {
|
|
|
|
console.log(m)
|
|
|
|
})
|
|
|
|
.catch(e => {
|
|
|
|
console.error(e)
|
|
|
|
})
|