Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
import 'reflect-metadata'
import minimist from 'minimist'
import * as path from 'path'
import * as packageJson from '../../package.json'
import { red, green, cyan, white, default as kleur } from 'kleur'
import { inject, injectable } from 'inversify'
import { CheckTypes } from './check-types'
import { Options } from './options'
import { MinCoverage } from './min-coverage'
const figlet = require('figlet')
kleur.enabled = require('color-support').level
@injectable()
export class Tscov {
public suppressError: boolean = false
constructor(
@inject('Options') private options: Options,
@inject('CheckTypes') private checkTypes: CheckTypes,
@inject('MinCoverage') private minCoverage: MinCoverage
) {
try {
this.executeTscov()
.then(success => {
this.showSpacesLog()
if (!success && !this.suppressError) {
process.exit(1)
import ora from 'ora';
import kleur from 'kleur';
kleur.enabled = require('color-support').level;
export class Log {
static log(text, color) {
console.log(kleur[color]().bold(text));
}
static info(text) {
this.log(text, 'cyan');
}
static primary(text) {
this.log(text, 'blue');
}
static success(text) {
this.log(text, 'green');
//Test environment conditions
const helpers = require('../extras/helpers');
helpers.dependencyChecker();
//Requires
const os = require('os');
const fs = require('fs-extra');
const readline = require('readline');
const { promisify } = require('util');
const axios = require("axios");
const ac = require('ansi-colors');
ac.enabled = require('color-support').hasBasic;
const { dir, log, logOk, logWarn, logError, cleanTerminal } = require('../extras/console');
cleanTerminal()
const context = 'SetupScript';
const printDivider = () => { log('='.repeat(64), context) };
//================================================================
//=================================================== Setup
//================================================================
//Setting up ReadLine
const rl = readline.createInterface({ input: process.stdin, output: process.stdout });
readline.Interface.prototype.question[promisify.custom] = function (prompt) {
return new Promise(resolve =>
readline.Interface.prototype.question.call(this, prompt, resolve),
);
const ac = require('ansi-colors');
ac.enabled = require('color-support').hasBasic;
const header = 'txAdmin';
let logHistory = [];
//Helpers
const now = () => { return Math.round(new Date() / 1000) };
const getConCtx = (ctx) => { return (ctx !== null)? header+':'+ctx : header };
const getHistCtx = (ctx) => { return (ctx !== null)? ctx : header };
const toHistory = (type, ctx, msg) =>{
if(logHistory.length > 4000){
let sliceMsg = {ts: now(), type: 'ERROR', ctx: 'ConsoleLog', msg: 'The log was sliced to prevent memory exhaustion.'};
logHistory = logHistory.slice(0,500).concat(sliceMsg, logHistory.slice(-500))
}
return logHistory.push({ts: now(), type, ctx, msg});
}
//Requires
const fs = require('fs');
const ac = require('ansi-colors');
ac.enabled = require('color-support').hasBasic;
const StreamSnitch = require('stream-snitch');
const bytes = require('bytes');
const { dir, log, logOk, logWarn, logError, cleanTerminal } = require('../../extras/console');
const context = 'ConsoleBuffer';
/**
* FXServer output buffer helper.
*
* FIXME: optimize this, we can have only one buffer using offset variables
* @param {string} logPath
* @param {int} saveInterval
*/
module.exports = class ConsoleBuffer {
constructor(logPath, saveInterval) {
this.hitchStreamProcessor = null;
this.logFileSize = null;