-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
81 lines (67 loc) · 2.37 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
75
76
77
78
79
80
var gulp = require('gulp');
var sourcemaps = require('gulp-sourcemaps');
var babel = require('gulp-babel');
var NodeWebkitBuilder = require('node-webkit-builder');
gulp.task('default', ['dist']);
gulp.task('compile', function() {
return gulp.src('app/**/*.es6')
.pipe(sourcemaps.init())
.pipe(babel())
.pipe(sourcemaps.write('.'))
.pipe(gulp.dest('.'));
});
//gulp.task('build', ['compile'], function() {
// return gulp.src('app/**/*')
// .pipe(gulp.dest('build'));
//});
gulp.task('dist', ['compile'], function(cb) {
// Find out which node modules to include
var modules = [];
var node = require('./package.json');
if (!!node.dependencies) {
modules = Object.keys(node.dependencies)
.filter(function (m) { return m != 'nodewebkit' })
.map(function (m) { return './node_modules/' + m + '/**/*' });
}
var bower = require('./bower.json');
if (!!bower.dependencies) {
modules = modules.concat(Object.keys(bower.dependencies)
.filter(function (m) { return m != 'nodewebkit' })
.map(function (m) { return './bower_components/' + m + '/**/*' }));
}
// Which platforms should we build
var options = ['osx', 'win', 'linux', 'osx32', 'osx64', 'win32', 'win64', 'linux32', 'linux64'];
var platforms;
if (process.argv.indexOf('--all') > -1) {
platforms = ['osx', 'win', 'linux'];
} else {
platforms = options.filter(function (opt) {
return process.argv.indexOf('--' + opt) > -1;
}
);
}
if (platforms.length == 0) {
if (process.platform === 'darwin') platforms.push(process.arch == 'x64' ? 'osx64' : 'osx32');
else if (process.platform === 'win32') platforms.push('win');
else if (process.arch === 'ia32') platforms.push('linux32');
else if (process.arch === 'x64') platforms.push('linux64');
}
// Initialize
var nw = new NodeWebkitBuilder({
files: ['./package.json', './build/**/*'].concat(modules),
version: '0.12.2',
name: 'cyclusjs',
cacheDir: './dist/cache',
buildDir: './dist',
platforms: platforms,
macIcns: './app/assets/icons/cyclus.icns',
//winIco: './app/assets/icons/cyclus.ico',
});
nw.on('log', function (msg) {
// Ignore 'Zipping... messages
if (msg.indexOf('Zipping') !== 0) console.log(msg)
});
nw.build(function (err) {
if (!!err) return console.error(err);
});
});