-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.js
38 lines (33 loc) · 1.05 KB
/
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
"use strict";
var through = require("through2");
var gutil = require("gulp-util");
var PluginError = gutil.PluginError;
require("es6-promise").polyfill();
var dtsm = require("dtsm");
var PLUGIN_NAME = "gulp-dtsm";
module.exports = function () {
return through.obj(function(file, enc, cb) {
if (file.isNull()) {
cb(null, file);
}
if (file.isStream()) {
cb(new PluginError(PLUGIN_NAME, "Streaming not supported"));
}
dtsm
.createManager({
configPath: file.relative
})
.then(function (manager) {
return manager.installFromFile();
})
.then(function (result) {
gutil.log(result.dependenciesList.length + " files created.");
result.dependenciesList.forEach(function (dep) {
gutil.log(dep.depName);
});
cb(null, file);
}, function (error) {
cb(new PluginError(PLUGIN_NAME, error));
});
});
};