2016-06-10 03:18:03 +00:00
|
|
|
import "typings-global";
|
2016-05-23 02:40:04 +00:00
|
|
|
let colors = require("colors");
|
|
|
|
import readline = require("readline");
|
|
|
|
let rl;
|
|
|
|
let initReadline = () => {
|
|
|
|
rl = readline.createInterface({
|
|
|
|
input: process.stdin,
|
|
|
|
output: process.stdout
|
|
|
|
});
|
|
|
|
};
|
|
|
|
|
|
|
|
let moduleName:string;
|
|
|
|
let loaderLength:number;
|
|
|
|
let frameCounter:number = 0;
|
|
|
|
|
|
|
|
let makeFrame = ():string => {
|
|
|
|
let resultString:string = "["
|
|
|
|
+ "/".green.repeat(frameCounter)
|
|
|
|
+ " ".repeat(loaderLength - frameCounter)
|
|
|
|
+ "]"
|
|
|
|
+ " starting "
|
|
|
|
+ moduleName.cyan;
|
|
|
|
|
|
|
|
if(frameCounter == loaderLength){
|
|
|
|
frameCounter = 0;
|
|
|
|
} else {
|
|
|
|
frameCounter++;
|
|
|
|
}
|
|
|
|
return resultString;
|
|
|
|
};
|
|
|
|
|
|
|
|
let logEarly = () => {
|
|
|
|
rl.write(null, {ctrl: true, name: 'u'});
|
|
|
|
rl.write(makeFrame());
|
|
|
|
setTimeout(function(){
|
|
|
|
logEarly();
|
2016-05-23 03:11:03 +00:00
|
|
|
},80);
|
2016-05-23 02:40:04 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
let start = function(moduleNameArg:string = "",loaderLengthArg:string = "10"){
|
|
|
|
moduleName = moduleNameArg;
|
|
|
|
loaderLength = parseInt(loaderLengthArg);
|
2016-05-23 03:11:03 +00:00
|
|
|
if (process.env.CI == "undefined"){
|
2016-05-23 02:40:04 +00:00
|
|
|
initReadline();
|
|
|
|
logEarly();
|
|
|
|
} else {
|
|
|
|
console.log("**** starting " + moduleName.cyan + " ****");
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
start(process.env.moduleNameArg,process.env.loaderLengthArg);
|