const builder = require('electron-builder') const Platform = builder.Platform function getCurrentPlatform() { switch (process.platform) { case 'win32': return Platform.WINDOWS case 'darwin': return Platform.MAC case 'linux': return Platform.linux default: console.error('Cannot resolve current platform!') return undefined } } builder.build({ targets: (process.argv[2] != null && Platform[process.argv[2]] != null ? Platform[process.argv[2]] : getCurrentPlatform()).createTarget(), config: { appId: 'adrianlauncher', productName: 'Adrian\'s Modpack Launcher', artifactName: 'adrianlauncher-${version}.${ext}', copyright: 'Copyright © 2018-2020 Adrian\'s Modpack', directories: { buildResources: 'build', output: 'dist' }, win: { target: [ { target: 'nsis-web', arch: 'x64' } ] }, nsis: { oneClick: true, perMachine: false, allowElevation: true, allowToChangeInstallationDirectory: false, }, mac: { target: 'dmg', category: 'public.app-category.games' }, linux: { target: 'AppImage', maintainer: 'Adrian\'s Modpack', vendor: 'Adrian\'s Modpack', synopsis: 'Modded Minecraft Launcher', description: 'Custom launcher which allows users to join modded servers. All mods, configurations, and updates are handled automatically.', category: 'Game' }, compression: 'maximum', files: [ '!{dist,.gitignore,.vscode,docs,dev-app-update.yml,.travis.yml,.nvmrc,.eslintrc.json,build.js}' ], extraResources: [ 'libraries' ], asar: true, publish: [ { provider: 'generic', url: 'https://minecraft.adriangonz.com/launcher/', channel: 'latest', } ], } }).then(() => { console.log('Build complete!') }).catch(err => { console.error('Error during build!', err) })