forked from hoffi/gulp-msbuild
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
31 lines (25 loc) · 768 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
'use strict';
var through = require('through2'),
_ = require('lodash'),
constants = require('./lib/constants'),
msbuildRunner = require('./lib/msbuild-runner');
function mergeOptionsWithDefaults(options) {
return _.extend(constants.DEFAULTS, options);
}
module.exports = function(options) {
var mergedOptions = _.cloneDeep(mergeOptionsWithDefaults(options));
var stream = through.obj(function(file, enc, callback) {
var self = this;
if (!file || !file.path) {
self.push(file);
return callback();
}
return msbuildRunner.startMsBuildTask(mergedOptions, file, function(err) {
if (err) return callback(err);
self.push(file);
self.emit("end");
return callback();
});
});
return stream;
};