Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function debug(this: ILogger, ...args: any[]): void {
// TODO: Add a new log level to replace this one
// if (env && !debugEnv.includes(env)) {
// return undefined;
// }
const channel = chalk.hex(LogColors.debug).bold(`@${this.channel}`);
console.log(`${fancyDecoration()}`, channel, ...args);
}
console.log(`[${new Date().toLocaleTimeString()}] ${chalk[color][bgcolor](msg)}.`);
}
let angularComponents;
try {
angularComponents = require("./build/angular-components.json");
} catch (ex) {
logToTerminal("No Angular component configuration found", "yellow");
angularComponents = null;
}
// #region Constants
const startupConfig = require("./configs/other/server-environment-startup");
//Force colors on terminals.
const errorOutColor = chalk.hex("#FF667E");
// #endregion
// #region Script variables
let watchClose;
// If you specify environment variables to child_process, it overwrites all environment variables, including
// PATH. So, copy based on our existing env variables.
const env = process.env;
if (!env.NODE_ENV) {
env.NODE_ENV = "development";
}
if (!env.PORT) {
env.PORT = startupConfig[env.NODE_ENV].serverPort;
}
addSupport: (root, name, manager) => {
console.log(chalk.hex('#cb00ff')('Installing Apollo'))
execSync(`cd ${name} && ${manager === 'npm' ? 'npm install --save ' : 'yarn add '} apollo-boost react-apollo graphql graphql-tag`, { stdio: [0, 1, 2] })
fs.unlinkSync(path.join(root, 'index.js'))
fs.writeFileSync(path.join(root, 'index.js'), `import * as React from 'react'
import { AppRegistry } from 'react-native'
import ApolloClient from 'apollo-boost'
import { ApolloProvider } from 'react-apollo'\n
import App from './App'
import { name as appName } from './app.json'\n
// Create the client as outlined in the setup guide
const client = new ApolloClient({
uri: 'https://w5xlvm3vzz.lp.gql.zone/graphql'
})\n
const Apollo = () => (
"-": "remove watch expression (-:)",
"?": "list existing watch expressions and breakpoints",
"b": "add breakpoint",
"B": "remove breakpoint",
"c": "continue until breakpoint",
"q": "quit",
"r": "reset",
"t": "load new transaction",
"T": "unload transaction"
};
const truffleColors = {
mint: chalk.hex("#3FE0C5"),
orange: chalk.hex("#E4A663"),
pink: chalk.hex("#E911BD"),
purple: chalk.hex("#8731E8"),
green: chalk.hex("#00D717"),
red: chalk.hex("#D60000"),
yellow: chalk.hex("#F2E941"),
blue: chalk.hex("#25A9E0"),
comment: chalk.hsl(30, 20, 50),
watermelon: chalk.hex("#E86591"),
periwinkle: chalk.hex("#7F9DD1")
};
var DebugUtils = {
gatherArtifacts: async function(config) {
// Gather all available contract artifacts
let files = await dir.promiseFiles(config.contracts_build_directory);
var contracts = files
.filter(file_path => {
over(success: boolean = true): void {
const time: [number, number] = hrtime(startTime)
const show: string = (time[1] / 1000000).toFixed(2)
if (!success) {
ora.fail(oraTask)
return process.exit(1)
}
ora.succeed(oraTask)
console.log(` ${chalk.hex('#44A6BE')(show + ' ms')}\n`)
},
},
const { namedColors } = require('../gh-badges/lib/color')
const { floorCount } = require('../services/color-formatters')
const { loadServiceClasses } = require('../core/base-service/loader')
const serviceClasses = loadServiceClasses()
const legacyServices = serviceClasses
.map(cls => (typeof cls.registerLegacyRouteHandler === 'function' ? 1 : 0))
.reduce((a, b) => a + b)
const newServices = serviceClasses.length - legacyServices
const percentDone = ((newServices / serviceClasses.length) * 100).toFixed(2)
const color = floorCount(percentDone, 10, 50, 100)
console.log(`Found ${serviceClasses.length} services:`)
console.log(`- ${legacyServices} legacy services`)
console.log(`- ${newServices} new services`)
console.log(chalk.hex(namedColors[color])(`${percentDone}% done`))
if (flockOnly) {
libraries.push('latestFlock');
} else {
libraries.push('lodash', 'arraySort', 'sortArray', 'native');
}
const runConfiguration = [
{ size: 100, noRuns: 100, flockOnly },
{ size: 1000, noRuns: 50, flockOnly },
{ size: 10000, noRuns: 25, flockOnly },
{ size: 100000, noRuns: 5, flockOnly }
];
const headerItems = [Chalk.hex('f49b42')('Library')];
headerItems.push(...runConfiguration.map((c) => Chalk.hex('f49b42')(`${c.size} items`)));
function getRowValue(name, run) {
if (!run[name]) {
return Chalk.red('NOT SUPPORTED');
}
const flock = run.flock.average;
const lib = run[name].average;
let comparison = '';
if (flock !== lib) {
const color = flock < lib ? 'red' : 'green';
const comparedToFlock = (Math.max(flock, lib) / Math.min(flock, lib)).toFixed(2);
comparison = Chalk[color](`${flock < lib ? '↓' : '↑'} ${comparedToFlock}x `);
comparison = `(${comparison})`;
function prefix(level: LogLevel, channel: string = '') {
const logLevelColor = LogColors[LogLevel[level]];
const cNamespace = chalk.hex('#7AC0DA').bold(`${namespace}`);
const cLevel = chalk.bold.hex(logLevelColor)(`\u2ACD ${LogLevel[level].toUpperCase()}\u2ACE `);
const cChannel = channel
? chalk.hex('#EE82EE').bold(`@${channel}`)
: '';
return `${cNamespace} ${cLevel} ${cChannel}`;
}
import chalk, { Chalk } from 'chalk';
import identity from 'lodash/identity';
type Identity = (t: T) => T;
type VersionMap = Record>;
const moduleMap: Record = {};
const colors = [
chalk.white,
chalk.hex('#9de5f7'),
chalk.hex('#66b5f9'),
chalk.hex('#00adf4'),
chalk.hex('#0082f4'),
chalk.hex('#8868f9'),
chalk.hex('#792bf7'),
chalk.hex('#ad7bfc'),
chalk.hex('#ce75f4'),
chalk.hex('#f993e5'),
chalk.hex('#f4a4d0'),
];
const renderVersion = (moduleName: string, version: string | number) => {
if (!moduleMap[moduleName]) {
moduleMap[moduleName] = {};
}
const versionMap = moduleMap[moduleName];
let color = versionMap[version];
function info(s) {
log(chalk.hex(INFO)('[INFO] %s'), s);
}