diff --git a/.gitignore b/.gitignore index a7f066b..9a37243 100644 --- a/.gitignore +++ b/.gitignore @@ -13,8 +13,8 @@ dist # Mac OS .DS_Store -# Electron-packager -KawAnime-* +# Dist +assets/build/dists/KawAnime* # Idea directory .idea \ No newline at end of file diff --git a/assets/build/material/background.png b/assets/build/material/background.png index 5746524..d849a47 100644 Binary files a/assets/build/material/background.png and b/assets/build/material/background.png differ diff --git a/assets/scripts/dist.js b/assets/scripts/dist.js index 8a67157..53122f8 100644 --- a/assets/scripts/dist.js +++ b/assets/scripts/dist.js @@ -18,7 +18,12 @@ const {join} = require('path') +// packages const packager = require('electron-packager') +const materialPath = join(__dirname, '..', 'build', 'material') + +// Installers +const createDMG = require('electron-installer-dmg') const colors = require('colors') @@ -28,18 +33,46 @@ const packOptions = { out: join(__dirname, '..', 'build', 'dists'), appCopyright: `© 2016 - ${(new Date()).getYear() + 1900} Kylart`, all: true, - icon: join(__dirname, '..', 'build', 'material', 'icon'), + icon: join(materialPath, 'icon'), overwrite: true // Check for signing app } -const buildDists = () => { +const dmgOptions = { + appPath: join(materialPath, '..', 'dists', 'KawAnime-darwin-x64', 'KawAnime.app'), + name: 'KawAnime', + background: join(materialPath, 'background.png'), + icon: join(materialPath, 'icon.icns'), + overwrite: true, + out: join(materialPath, '..', 'dists'), + "icon-size": 80 +} +const makeDMG = () => { + console.log('[Builder]: Creating DMG...'.yellow) + + createDMG(dmgOptions, function done(err) { + if (err) + { + console.log('[Builder]: An error occurred while creating DMG.'.red) + throw err + } + + console.log('[Builder]: Successfully built DMG!'.green) + }) +} + +const buildDists = () => { + makeDMG() } const pack = () => { packager(packOptions, function done_callback(err, appPaths) { - if (err) throw err + if (err) + { + console.log('[Builder]: An occurred while packaging KawAnime!'.red) + throw err + } appPaths.forEach((path) => { console.log(`[Builder]: Successfully built ${path}!`.green)