2016-05-20 17:06:25 +00:00
|
|
|
"use strict";
|
2016-06-10 03:18:03 +00:00
|
|
|
require("typings-global");
|
2016-05-23 02:51:45 +00:00
|
|
|
var path = require("path");
|
2016-06-11 21:47:52 +00:00
|
|
|
var q = require("q");
|
2016-05-23 02:40:04 +00:00
|
|
|
var childProcess = require("child_process");
|
|
|
|
var earlyChild;
|
2016-06-10 03:18:03 +00:00
|
|
|
var doAnimation = true;
|
2016-06-10 03:36:06 +00:00
|
|
|
var doText = false;
|
|
|
|
if (process.argv.indexOf("-v") != -1 || process.env.CI) {
|
2016-06-10 03:18:03 +00:00
|
|
|
doAnimation = false;
|
|
|
|
}
|
2016-06-10 03:43:27 +00:00
|
|
|
else if (process.argv.indexOf("-v") == -1) {
|
2016-06-10 03:36:06 +00:00
|
|
|
doText = true;
|
|
|
|
}
|
2016-05-21 18:33:13 +00:00
|
|
|
// exports
|
|
|
|
exports.start = function (moduleNameArg, loaderLengthArg) {
|
2016-05-21 22:38:14 +00:00
|
|
|
if (moduleNameArg === void 0) { moduleNameArg = ""; }
|
2016-05-23 02:40:04 +00:00
|
|
|
if (loaderLengthArg === void 0) { loaderLengthArg = "10"; }
|
2016-06-10 03:18:03 +00:00
|
|
|
if (doAnimation) {
|
|
|
|
earlyChild = childProcess.fork(path.join(__dirname, "early.child.js"), [], {
|
|
|
|
env: {
|
|
|
|
moduleNameArg: moduleNameArg,
|
|
|
|
loaderLengthArg: loaderLengthArg,
|
|
|
|
CI: process.env.CI
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
2016-06-10 03:36:06 +00:00
|
|
|
else if (doText) {
|
|
|
|
console.log("**** starting " + moduleNameArg.cyan + " ****");
|
|
|
|
}
|
2016-05-20 17:06:25 +00:00
|
|
|
};
|
|
|
|
exports.stop = function () {
|
2016-06-11 21:53:48 +00:00
|
|
|
var done = q.defer();
|
2016-06-10 03:18:03 +00:00
|
|
|
if (doAnimation) {
|
|
|
|
earlyChild.kill();
|
2016-06-11 21:47:52 +00:00
|
|
|
earlyChild.on("close", function () {
|
2016-06-11 21:53:48 +00:00
|
|
|
done.resolve();
|
2016-06-11 21:47:52 +00:00
|
|
|
});
|
2016-06-10 03:18:03 +00:00
|
|
|
}
|
2016-06-11 21:53:48 +00:00
|
|
|
else {
|
|
|
|
done.resolve();
|
|
|
|
}
|
|
|
|
return done.promise;
|
2016-05-20 17:06:25 +00:00
|
|
|
};
|
|
|
|
|
2016-06-11 22:12:40 +00:00
|
|
|
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImluZGV4LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7QUFBQSxRQUFPLGdCQUNQLENBQUMsQ0FEc0I7QUFFdkIsSUFBTyxJQUFJLFdBQVcsTUFBTSxDQUFDLENBQUM7QUFDOUIsSUFBSSxDQUFDLEdBQUcsT0FBTyxDQUFDLEdBQUcsQ0FBQyxDQUFDO0FBRXJCLElBQU8sWUFBWSxXQUFXLGVBQWUsQ0FBQyxDQUFDO0FBQy9DLElBQUksVUFBVSxDQUFDO0FBRWYsSUFBSSxXQUFXLEdBQVcsSUFBSSxDQUFDO0FBQy9CLElBQUksTUFBTSxHQUFXLEtBQUssQ0FBQztBQUMzQixFQUFFLENBQUEsQ0FBQyxPQUFPLENBQUMsSUFBSSxDQUFDLE9BQU8sQ0FBQyxJQUFJLENBQUMsSUFBSSxDQUFDLENBQUMsSUFBSSxPQUFPLENBQUMsR0FBRyxDQUFDLEVBQUUsQ0FBQyxDQUFBLENBQUM7SUFDbkQsV0FBVyxHQUFHLEtBQUssQ0FBQztBQUN4QixDQUFDO0FBQUMsSUFBSSxDQUFDLEVBQUUsQ0FBQSxDQUFDLE9BQU8sQ0FBQyxJQUFJLENBQUMsT0FBTyxDQUFDLElBQUksQ0FBQyxJQUFJLENBQUMsQ0FBQyxDQUFDLENBQUEsQ0FBQztJQUN4QyxNQUFNLEdBQUcsSUFBSSxDQUFDO0FBQ2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