build.js 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. const builder = require('electron-builder')
  2. const Platform = builder.Platform
  3. function getCurrentPlatform(){
  4. switch(process.platform){
  5. case 'win32':
  6. return Platform.WINDOWS
  7. case 'darwin':
  8. return Platform.MAC
  9. case 'linux':
  10. return Platform.linux
  11. default:
  12. console.error('Cannot resolve current platform!')
  13. return undefined
  14. }
  15. }
  16. builder.build({
  17. targets: (process.argv[2] != null && Platform[process.argv[2]] != null ? Platform[process.argv[2]] : getCurrentPlatform()).createTarget(),
  18. config: {
  19. appId: 'helioslauncher',
  20. productName: 'Helios Launcher',
  21. artifactName: '${productName}.${ext}',
  22. copyright: 'Copyright © 2018-2020 Daniel Scalzi',
  23. directories: {
  24. buildResources: 'build',
  25. output: 'dist'
  26. },
  27. win: {
  28. target: [
  29. {
  30. target: 'nsis',
  31. arch: 'x64'
  32. }
  33. ]
  34. },
  35. nsis: {
  36. oneClick: false,
  37. perMachine: false,
  38. allowElevation: true,
  39. allowToChangeInstallationDirectory: true
  40. },
  41. mac: {
  42. target: 'dmg',
  43. category: 'public.app-category.games'
  44. },
  45. linux: {
  46. target: 'AppImage',
  47. maintainer: 'Daniel Scalzi',
  48. vendor: 'Daniel Scalzi',
  49. synopsis: 'Modded Minecraft Launcher',
  50. description: 'Custom launcher which allows users to join modded servers. All mods, configurations, and updates are handled automatically.',
  51. category: 'Game'
  52. },
  53. compression: 'maximum',
  54. files: [
  55. '!{dist,.gitignore,.vscode,docs,dev-app-update.yml,.travis.yml,.nvmrc,.eslintrc.json,build.js}'
  56. ],
  57. extraResources: [
  58. 'libraries'
  59. ],
  60. asar: true
  61. }
  62. }).then(() => {
  63. console.log('Build complete!')
  64. }).catch(err => {
  65. console.error('Error during build!', err)
  66. })