|
1 | 1 | const path = require('path') |
2 | 2 | const ChildProcess = require('child_process') |
3 | 3 | const packager = require('electron-packager') |
4 | | -const archiver = require('archiver') |
5 | 4 | const fs = require('fs') |
6 | 5 | if (process.platform === 'darwin') { |
7 | 6 | const appdmg = require('appdmg') |
@@ -57,23 +56,8 @@ module.exports = function (grunt) { |
57 | 56 | grunt.registerTask('zip', function (platform) { |
58 | 57 | var done = this.async() |
59 | 58 | switch (platform) { |
60 | | - case 'win': |
61 | | - var archive = archiver.create('zip', {}) |
62 | | - var basename = 'Boostnote-installer-win32-x64' |
63 | | - archive.file(path.join('dist/Setup.exe'), { |
64 | | - name: basename + '.exe' |
65 | | - }) |
66 | | - archive.finalize() |
67 | | - var writeStream = fs.createWriteStream(path.join('dist/' + basename + '.zip')) |
68 | | - archive.pipe(writeStream) |
69 | | - writeStream.on('close', function () { |
70 | | - grunt.log.writeln('Zipped!') |
71 | | - done() |
72 | | - }) |
73 | | - break |
74 | 59 | case 'osx': |
75 | | - |
76 | | - var execPath = 'zip -r -y -q dist/Boostnote.zip dist/Boostnote-darwin-x64/Boostnote.app' |
| 60 | + var execPath = 'cd dist/Boostnote-darwin-x64 && zip -r -y -q ../Boostnote-mac.zip Boostnote.app' |
77 | 61 | grunt.log.writeln(execPath) |
78 | 62 | ChildProcess.exec(execPath, |
79 | 63 | function (err, stdout, stderr) { |
@@ -178,7 +162,7 @@ module.exports = function (grunt) { |
178 | 162 | var done = this.async() |
179 | 163 |
|
180 | 164 | var stream = appdmg({ |
181 | | - target: 'dist/Boostnote-darwin-x64.dmg', |
| 165 | + target: 'dist/Boostnote-mac.dmg', |
182 | 166 | basepath: __dirname, |
183 | 167 | specification: { |
184 | 168 | 'title': 'Boostnote', |
@@ -207,10 +191,10 @@ module.exports = function (grunt) { |
207 | 191 | } |
208 | 192 | switch (platform) { |
209 | 193 | case 'win': |
210 | | - grunt.task.run(['pack:win', 'create-windows-installer', 'zip:win']) |
| 194 | + grunt.task.run(['compile', 'pack:win', 'create-windows-installer']) |
211 | 195 | break |
212 | 196 | case 'osx': |
213 | | - grunt.task.run(['pack:osx', 'codesign', 'create-osx-installer', 'zip:osx']) |
| 197 | + grunt.task.run(['compile', 'pack:osx', 'codesign', 'create-osx-installer', 'zip:osx']) |
214 | 198 | break |
215 | 199 | } |
216 | 200 | }) |
|
0 commit comments