-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
44 lines (27 loc) · 888 Bytes
/
index.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
var NWBuilder = require('node-webkit-builder');
var through = require('through2');
var gutil = require('gulp-util');
var PluginError = gutil.PluginError;
var PLUGIN_NAME = 'gulp-webkit-builder';
var builder = function(options) {
var options = options || {};
var files = [];
var stream = through.obj(function(file, encoding, next) {
files.push(file.path);
next();
}, function(cb) {
var self = this;
options.files = files;
var nw = new NWBuilder(options);
nw.on('log', gutil.log);
nw.build().then(function() {
gutil.log('all done!');
cb();
}).catch(function(err) {
self.emit('error', new PluginError(PLUGIN_NAME, 'Error occured while building app!'));
return cb();
});
});
return stream;
};
module.exports = builder;