diff --git a/.gitignore b/.gitignore index f1d8528f3..b08285edf 100644 --- a/.gitignore +++ b/.gitignore @@ -16,6 +16,7 @@ debug.log docs/output docs/includes spec/fixtures/evil-files/ +build/resources/certs /_site /.sass-cache .integration-test-config diff --git a/build/Gruntfile.js b/build/Gruntfile.js index e98176698..185542665 100644 --- a/build/Gruntfile.js +++ b/build/Gruntfile.js @@ -54,7 +54,8 @@ module.exports = (grunt) => { if (grunt.option('platform') === 'win32') { postBuildSteps.push('create-windows-installer') } else if (grunt.option('platform') === 'darwin') { - postBuildSteps.push('create-mac-installer') + postBuildSteps.push('create-mac-zip') + postBuildSteps.push('create-mac-dmg') } else if (grunt.option('platform') === 'linux') { postBuildSteps.push('create-deb-installer'); postBuildSteps.push('create-rpm-installer'); diff --git a/build/package.json b/build/package.json index d270b0c63..c086410f4 100644 --- a/build/package.json +++ b/build/package.json @@ -9,7 +9,9 @@ "archiver": "1.2.x", "chalk": "1.x.x", "coffeelint-cjsx": "^2.0", + "electron-installer-dmg": "0.2.0", "electron-packager": "^8.4.0", + "glob": "7.1.1", "grunt": "~0.4.1", "grunt-cli": "~0.1.9", "grunt-coffee-react": "^5.0.0", @@ -21,7 +23,6 @@ "grunt-electron-installer": "2.1.0", "grunt-lesslint": "0.13.0", "minidump": "~0.8", - "glob": "7.1.1", "request": "^2.64", "s3": "^4.3", "temp": "~0.8.1", diff --git a/build/resources/mac/Nylas-Mail-DMG-Background.png b/build/resources/mac/Nylas-Mail-DMG-Background.png new file mode 100644 index 000000000..1def5c06f Binary files /dev/null and b/build/resources/mac/Nylas-Mail-DMG-Background.png differ diff --git a/build/tasks/create-mac-dmg.js b/build/tasks/create-mac-dmg.js new file mode 100644 index 000000000..81639e08d --- /dev/null +++ b/build/tasks/create-mac-dmg.js @@ -0,0 +1,25 @@ +const path = require('path'); +const createDMG = require('electron-installer-dmg') + +module.exports = (grunt) => { + grunt.registerTask('create-mac-dmg', 'Create DMG for Nylas Mail', function pack() { + const done = this.async(); + const dmgPath = path.join(grunt.config('outputDir'), "NylasMail.dmg"); + createDMG({ + appPath: path.join(grunt.config('outputDir'), "Nylas Mail-darwin-x64", "Nylas Mail.app"), + name: "NylasMail", + background: path.resolve(grunt.config('appDir'), 'build', 'resources', 'mac', 'Nylas-Mail-DMG-background.png'), + icon: path.resolve(grunt.config('appDir'), 'build', 'resources', 'mac', 'nylas.icns'), + overwrite: true, + out: grunt.config('outputDir'), + }, (err) => { + if (err) { + done(err); + return + } + + grunt.log.writeln(`>> Created ${dmgPath}`); + done(null); + }) + }); +}; diff --git a/build/tasks/installer-mac-task.js b/build/tasks/create-mac-zip.js similarity index 90% rename from build/tasks/installer-mac-task.js rename to build/tasks/create-mac-zip.js index 6caec01ce..fcd90ceec 100644 --- a/build/tasks/installer-mac-task.js +++ b/build/tasks/create-mac-zip.js @@ -6,7 +6,7 @@ const path = require('path'); module.exports = (grunt) => { const {spawn} = require('./task-helpers')(grunt); - grunt.registerTask('create-mac-installer', 'Zip up Nylas Mail', function pack() { + grunt.registerTask('create-mac-zip', 'Zip up Nylas Mail', function pack() { const done = this.async(); const zipPath = path.join(grunt.config('outputDir'), 'NylasMail.zip'); diff --git a/build/tasks/publish-task.js b/build/tasks/publish-task.js index d6725f20c..9f1a91317 100644 --- a/build/tasks/publish-task.js +++ b/build/tasks/publish-task.js @@ -107,6 +107,10 @@ module.exports = (grunt) => { source: `${outputDir}/NylasMail.zip`, key: `${fullVersion}/${process.platform}/${process.arch}/NylasMail.zip`, }); + uploads.push({ + source: `${outputDir}/NylasMail.dmg`, + key: `${fullVersion}/${process.platform}/${process.arch}/NylasMail.dmg`, + }); } else if (process.platform === 'win32') { uploads.push({ source: `${outputDir}/RELEASES`,