-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
70 lines (61 loc) · 2.04 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
const gulp = require('gulp'),
clean = require('gulp-clean'),
install = require('gulp-install'),
babel = require('gulp-babel'),
packager = require('electron-packager'),
runElectron = require("gulp-run-electron"),
eslint = require('gulp-eslint');
gulp.task('clean', () => {
return gulp.src('package', {read: false})
.pipe(clean({force: true}));
});
gulp.task('copy-app', () => {
return gulp.src(['app/**/*', 'images/**/*', 'main.js', 'package.json'], {base: '.'})
.pipe(gulp.dest('package'));
});
gulp.task('install', () => {
return gulp.src('./package/package.json')
.pipe(install({production: true}));
});
gulp.task('precompile', () => {
return gulp.src('./package/**/*.js')
.pipe(babel({
presets: ['es2015']
}))
.pipe(gulp.dest('./package'))
});
gulp.task('run', () => {
gulp.src("./package")
.pipe(runElectron());
});
gulp.task('package', () => {
const options = {
dir: "./package",
platform: "darwin",
arch: "x64",
icon: "./images/icon.icns",
out: "./_packages",
overwrite: true,
asar: true,
"app-version": "0.2.0"
};
packager(options, function done (err, appPath) {
if(err) { return console.log(err); }
console.log('App created: ' + appPath);
// gulp.src('package', {read: false})
// .pipe(clean({force: true}));
});
});
gulp.task('lint', function () {
return gulp.src(['./app/**/*.js', 'main.js', '!*/node_modules/**'])
.pipe(eslint())
.pipe(eslint.format())
.pipe(eslint.failAfterError());
});
gulp.task('watch', () => {
gulp.watch(['./app/**/*', 'main.js'], ['start-dev']);
});
gulp.task('default', gulp.series('clean', 'lint', 'copy-app', 'install', 'precompile', 'package'));
gulp.task('start-dev', gulp.series('clean', 'lint', 'copy-app', 'install', 'precompile', 'run'));
gulp.task('start-dev-no-lint', gulp.series('clean', 'copy-app', 'install', 'precompile', 'run'));
gulp.task('lint', gulp.series('clean', 'lint'));