This repository has been archived by the owner on Nov 7, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 157
/
gulpfile.babel.js
76 lines (58 loc) · 2.49 KB
/
gulpfile.babel.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
71
72
73
74
75
76
import { execSync } from 'child_process';
import gulp from 'gulp';
import requireDir from 'require-dir';
import runSequence from 'run-sequence';
requireDir('./tasks');
global.if_release = process.argv.indexOf('release') > -1;
gulp.task('main', function(cb) {
return runSequence('delete-dev', 'mkdir:app', ['electron:packagejson', 'electron:settings', 'stylus'], cb);
});
gulp.task('dev', function() {
return runSequence('main', 'copy:data', 'dev-folder', 'run-watch');
});
gulp.task('debug', function() {
return runSequence('main', 'copy:data', 'dev-folder', 'run-debug');
});
gulp.task('package-asar', function(cb) {
return runSequence('main', ['babel', 'electron:deps'], ['copy:app', 'copy:data', 'copy:translations', 'copy:views', 'clean:node_modules'], 'marko', 'asar', cb);
});
gulp.task('build', function(cb) {
if (process.platform === 'win32') return runSequence('build:win', cb);
return runSequence('build:osx', cb);
});
gulp.task('build:osx', function(cb) {
return runSequence('package-asar', 'compile:osx', 'move:compiled-mac:folder', cb);
});
gulp.task('build:win', function(cb) {
return runSequence('package-asar', 'compile:win', 'move:compiled-win:folder', cb);
});
gulp.task('build:win-sign', function(cb) {
return runSequence('package-asar', 'compile:win', 'sign:win', 'move:compiled-win:folder', cb);
});
gulp.task('pre-dist', function(cb) {
return runSequence('test', 'delete-releases', 'create-releases-folder', cb);
});
gulp.task('dist', function(cb) {
return runSequence('test', 'delete-releases', 'create-releases-folder', 'package-asar', 'compile:all', 'sign:win', 'zip:all', cb);
});
gulp.task('dist:win', function(cb) {
return runSequence('package-asar', 'compile:win', 'compile:win-installer', 'sign:win', 'zip:win', cb);
});
gulp.task('dist:osx', function(cb) {
return runSequence('package-asar', 'compile:osx', 'compile:dmg', 'zip:osx', cb);
});
gulp.task('release', function(cb) {
return runSequence('dist', 'virustotal', 'github-release', cb);
});
gulp.task('upload', function(cb) {
return runSequence('virustotal', 'github-release', cb);
});
gulp.task('postinstall', function() {
if (process.platform === 'darwin') {
console.log('Replacing signtool.exe');
execSync('curl -Ls "https://github.com/dustinblackman/mono-signtool/releases/download/0.0.2/mono-signtool.tar.gz" | tar xz -C ./node_modules/electron-winstaller/vendor/');
}
if (process.platform === 'win32') {
execSync('.\\node_modules\\.bin\\electron-rebuild.cmd -f -a ia32 -w runas');
}
});