early/dist/index.js

44 lines
4.6 KiB
JavaScript
Raw Normal View History

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-10 03:18:03 +00:00
var readline = require("readline");
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:36:06 +00:00
else if (process.argv.indexOf("-v") != -1) {
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 = ""; }
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-10 03:18:03 +00:00
if (doAnimation) {
earlyChild.kill();
var rl = readline.createInterface({
input: process.stdin,
output: process.stdout
});
rl.close();
}
2016-05-20 17:06:25 +00:00
};
2016-06-10 03:36:06 +00:00
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImluZGV4LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7QUFBQSxRQUFPLGdCQUNQLENBQUMsQ0FEc0I7QUFFdkIsSUFBTyxJQUFJLFdBQVcsTUFBTSxDQUFDLENBQUM7QUFDOUIsSUFBTyxRQUFRLFdBQVcsVUFBVSxDQUFDLENBQUM7QUFDdEMsSUFBTyxZQUFZLFd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