-
Notifications
You must be signed in to change notification settings - Fork 30
/
gulpfile.js
70 lines (62 loc) · 1.69 KB
/
gulpfile.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
var gulp = require('gulp');
var uglify = require('gulp-uglify');
var webpack = require('webpack-stream');
var packager = require('electron-packager');
var _ = require('lodash');
var fs = require('fs');
gulp.task('default', function() {
return gulp.src('src/entry.js')
.pipe(webpack( require('./webpack.config.js') ))
.pipe(uglify())
.pipe(gulp.dest('dist/js/'));
});
var BASE_OPTION = {
dir: '.',
overwrite: true,
arch: 'x64',
version: '0.36.10',
'build-version': '0.8.3',
'app-version': '0.8.3',
ignore: '(node_modules\/(codemirror|highlight.js|marked|vue|vue-resource)|src|icons|releases|.idea.*|README\.md|\.DS_Store|env|gulpfile\.js|webpack\.config\.js|\.gitignore)',
asar: true,
prune: true
};
gulp.task('electron', function(done) {
packager(_.defaults(_.clone(BASE_OPTION), {
out: 'releases/darwin/',
platform: 'darwin',
icon: './icons/pilemd.icns',
sign: process.env['PM_OSX_SIGN'],
'helper-buldle-id': 'md.pile.helper',
'app-bundle-id': 'md.pile'
}), function() {
done();
});
});
gulp.task('electron-linux', function(done) {
packager(_.defaults(_.clone(BASE_OPTION), {
out: 'releases/linux/',
platform: 'linux'
}), function(err, apppath) {
done();
fs.writeFileSync(
apppath[0] + '/README.md',
fs.readFileSync('./forlinux/README.md')
);
fs.writeFileSync(
apppath[0] + '/LICENSE',
fs.readFileSync('./LICENSE')
);
});
});
gulp.task('electron-windows', function(done) {
var c = _.defaults(_.clone(BASE_OPTION), {
out: 'releases/windows/',
platform: 'win32',
icon: './icons/pilemd.ico'
});
// c['arch'] = 'ia32';
packager(c, function() {
done();
});
});