|
1 | 1 | const path = require('path') |
2 | 2 | const ChildProcess = require('child_process') |
3 | 3 | const packager = require('electron-packager') |
4 | | -const appdmg = process.platform === 'darwin' |
5 | | - ? require('appdmg') |
6 | | - : null |
7 | 4 |
|
8 | 5 | module.exports = function (grunt) { |
9 | 6 | var auth_code |
@@ -76,7 +73,7 @@ module.exports = function (grunt) { |
76 | 73 | prune: true, |
77 | 74 | overwrite: true, |
78 | 75 | out: path.join(__dirname, 'dist'), |
79 | | - ignore: /submodules\/ace\/(?!src-min)|submodules\/ace\/(?=src-min-noconflict)|node_modules\/devicon\/icons|dist|^\/browser|^\/secret|\.babelrc|\.gitignore|^\/\.gitmodules|^\/gruntfile|^\/readme.md|^\/webpack/ |
| 76 | + ignore: /submodules\/ace\/(?!src-min)|submodules\/ace\/(?=src-min-noconflict)|node_modules\/devicon\/icons|dist|^\/browser|^\/secret|\.babelrc|\.gitignore|^\/\.gitmodules|^\/gruntfile|^\/readme.md|^\/webpack|^\/appdmg\.json/ |
80 | 77 | } |
81 | 78 | switch (platform) { |
82 | 79 | case 'win': |
@@ -143,29 +140,19 @@ module.exports = function (grunt) { |
143 | 140 |
|
144 | 141 | grunt.registerTask('create-osx-installer', function () { |
145 | 142 | var done = this.async() |
146 | | - |
147 | | - var stream = appdmg({ |
148 | | - target: 'dist/Boostnote-mac.dmg', |
149 | | - basepath: __dirname, |
150 | | - specification: { |
151 | | - 'title': 'Boostnote', |
152 | | - 'icon': 'resources/dmg.icns', |
153 | | - 'background': 'resources/boostnote-install.png', |
154 | | - 'icon-size': 80, |
155 | | - 'contents': [ |
156 | | - { 'x': 448, 'y': 344, 'type': 'link', 'path': '/Applications' }, |
157 | | - { 'x': 192, 'y': 344, 'type': 'file', 'path': 'dist/Boostnote-darwin-x64/Boostnote.app' } |
158 | | - ] |
159 | | - } |
160 | | - }) |
161 | | - stream.on('finish', function () { |
162 | | - done() |
163 | | - }) |
164 | | - |
165 | | - stream.on('error', function (err) { |
166 | | - grunt.log.writeln(err) |
167 | | - done(false) |
168 | | - }) |
| 143 | + var execPath = 'appdmg appdmg.json dist/Boostnote-mac.dmg' |
| 144 | + grunt.log.writeln(execPath) |
| 145 | + ChildProcess.exec(execPath, |
| 146 | + function (err, stdout, stderr) { |
| 147 | + grunt.log.writeln(stdout) |
| 148 | + if (err) { |
| 149 | + grunt.log.writeln(err) |
| 150 | + grunt.log.writeln(stderr) |
| 151 | + done(false) |
| 152 | + return |
| 153 | + } |
| 154 | + done() |
| 155 | + }) |
169 | 156 | }) |
170 | 157 |
|
171 | 158 | grunt.registerTask('zip', function (platform) { |
|
0 commit comments