This repository has been archived by the owner on Jun 19, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 21
/
Copy pathgulpfile.js
74 lines (66 loc) · 1.94 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
71
72
73
74
"use strict"
var gulp = require('gulp')
var inno = require('gulp-inno');
var electron = require('gulp-electron');
var fs = require('fs');
var clean = require('gulp-clean');
var path = require('path');
var R = require('ramda');
var gnf = require('./npm-files');
var pkg = require(`${process.cwd()}/package.json`);
var compileDir = './compile';
gulp.task('version', function(){
var pkg = require(`${process.cwd()}/package.json`);
fs.writeFileSync('version.json', JSON.stringify({
version: pkg.version,
}))
})
gulp.task('copy', ['version','copy:modules'], function(){
return gulp.src(
pkg.sourceFiles || ['**/**', '!node_modules/**/**', '!compile/**/**', '!release/**/**'],
{ base: './' }
).pipe(gulp.dest(compileDir));
});
gulp.task('copy:modules', function(){
return new Promise(function(resolve,reject){
gnf().then(function(src){
gulp.src(src, { base : './' })
.pipe(gulp.dest(compileDir))
.on('end',resolve);
});
})
});
gulp.task('electron',['copy'], function() {
return gulp.src("")
.pipe(electron({
src: './compile',
release: './release',
cache: './.cache',
packageJson: pkg,
packaging: true,
version: process.env.ELECTRON_VERSION,
platforms: process.env.PLATFORMS.split(','),
asar: true,
platformResources: {
win: {
"version-string": pkg.version,
"file-version": pkg.version,
"product-version": pkg.version,
icon: process.env.ICON,
},
}
}))
.pipe(gulp.dest(""));
})
gulp.task('prevent', ['electron'], function() {
return gulp.src(R.map(function(platform) {
return path.resolve(process.cwd(), `release/${process.env.ELECTRON_VERSION}/${platform}/resources/app/`);
}, process.env.PLATFORMS.split(','))
).pipe(clean({
force: true
}));
});
gulp.task('inno', ['prevent'], function() {
return gulp.src(process.env.INNOFILE).pipe(inno());
});
gulp.task('default', ['copy'])