How to use the colors/safe.red function in colors

To help you get started, we’ve selected a few colors examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github infinitered / ignite / ignite-generator / src / validation.js View on Github external
const verifyExtensiveTools = () => {
  // verify rnpm exists
  if (!Shell.which('rnpm')) {
    console.log(colors.red('This script requires rnpm to be installed.'))
    console.log(colors.green('Installing rnpm...'))
    Shell.exec('npm i -g rnpm')
  // Enforce latest rnpm -> line count of npm outdated should be zero
  } else if (!Shell.exec('npm outdated -g rnpm | wc -l | grep 0')) {
    console.log(colors.red('We depend on an updated rnpm.'))
    console.log(colors.yellow('Please update with ') + colors.green('npm i -g rnpm'))
    console.log(colors.red('Exiting!'))
    Shell.exit(1)
  }
}
github aws / aws-cdk / packages / decdk / bin / decdk.ts View on Github external
main().catch(e => {
  // tslint:disable-next-line:no-console
  console.error(colors.red(e));
  process.exit(1);
});
github infinitered / ignite / ignite-generator / src / app / index.es View on Github external
initializing () {
    // this is a fresh install, so let's always clobber the destination.
    this.conflicter.force = true
    // prep our spinner
    this.spinner = ora('starting')

    this.log('-----------------------------------------------')
    this.log(colors.red('  (                  )   (                   '))
    this.log(colors.red('  )\\ )   (        ( /(   )\\ )    *   )       '))
    this.log(colors.red(' (()/(   )\\ )     )\\()) (()/(  ` )  /(   (   '))
    this.log(colors.red('  /(_)) (()/(    ((_)\\   /(_))  ( )(_))  )\\  '))
    this.log(colors.red(' (_))    /(_))_   _((_) (_))   (_(_())  ((_) '))
    this.log(' |_ _|  ' + colors.red('(_))') + ' __| | \\| | |_ _|  |_   _|  | __|')
    this.log('  | |     | (_ | | .` |  | |     | |    | _| ')
    this.log(' |___|     \\___| |_|\\_| |___|    |_|    |___|')
    this.log('-----------------------------------------------')
    this.log('')
    this.log('An unfair headstart for your React Native apps.')
    this.log(colors.yellow('https://infinite.red/ignite'))
    this.log('')
    this.log('-----------------------------------------------')

    this.log('Igniting ' + colors.yellow(this.name) + '\n')
  }
github mulesoft-labs / api-console-cli / bin / api-console-dev.js View on Github external
return;
    }
    try {
      const script = new ApiDev(raml, options);
      script.run()
      .catch((cause) => {
        console.log(colors.red('  ' + cause.message));
        console.log();
        if (options.verbose) {
          console.log(cause.stack);
          console.log();
        }
        process.exit(1);
      });
    } catch (e) {
      console.log(colors.red('  ' + e.message));
      console.log();
      if (options.verbose) {
        console.log(e.stack);
        console.log();
      }
      process.exit(1);
    }
  })
  .on('--help', function() {
github zombieleet / BlackOrphan / listener.js View on Github external
prompt.prompt();
	    break;
	case 'killclient':

	    let clientId = data.split(/\s+/)[1].trim();

	    if ( clientId && Number.isInteger(Number(clientId))) {

		let userRegexp = new RegExp(`^(${clientId}){1,}`);

		let removeClient = Object.keys(socketList).filter(( l ) => (userRegexp.test(l)) );

		console.log(removeClient, currentClient['id']);

		if ( removeClient.length !== 1 ) {
		    process.stdout.write(color.red("There is no user with the id of " +  clientId));
		    prompt.prompt();
		    return ;
		} else if ( removeClient.toString() === currentClient['id'] ) {

		    delete socketList[removeClient];
		    
		    let objNames = Object.getOwnPropertyNames(socketList);
		    
		    try {
			currentClient = socketList[objNames[objNames.length - 1]];
			prompt.setPrompt({ id, port, address} = currentClient);
		    } catch (e) {
			let id = port = address = '**';
			prompt.setPrompt({id, port, address});
		    }
		    prompt.prompt();
github google / WebFundamentals / tools / importtrans.js View on Github external
totals.count += result.count;
      totals.success += result.success;
      totals.error += result.error;
      totals.skipped += result.skipped;
      totals.details = totals.details.concat(result.details);
    } else {
      console.log('Skipped: ', colors.yellow(lang));
    }
  });

  console.log('Languages:', totals.langs.length, totals.langs.join(', '));
  console.log('Files:', colors.cyan(totals.count));
  console.log('Success:', colors.green(totals.success));
  console.log('Warnings:', colors.yellow(totals.warning));
  console.log('Skipped:', colors.yellow(totals.skipped));
  console.log('Errors:', colors.red(totals.error));
  if (totals.details.length > 0) {
    console.log(' See', colors.red('importtrans.log'), 'for details.');
    console.log(' Source files retained in:', commander.temp);
    var errorLog = 'WebFundamentals ImportTrans Log\n';
    errorLog += new Date() + '\n';
    errorLog += 'Working directory: ' + pathToFiles + '\n\n';
    under.each(totals.details, function(err) {
      errorLog += err.file + '\n';
      var msg = err.error.message;
      errorLog += '  ' + msg + '\n\n';
    });
    fs.writeFileSync('importtrans.log', errorLog);
  }

  if ((removeWhenDone === true) && (totals.details.length === 0)) {
    rimraf(pathToFiles, function(err) {
github hyj1991 / easy-monitor / src_logic / common / common.config.js View on Github external
/** 
                     * @param {array} bef 表示在该 file 文件之前必须是数组中的文件
                    */
                    let bef = order.bef || [];
                    //判断该 config 文件所需的所有前置配置项均已获得: 如果是则继续走原始 merge 逻辑,否则设置侦听事件
                    const allHave = bef.every(na => Boolean(pre[`${na}`]));
                    if (!allHave) {
                        //筛选出尚未生成的配置项,设置侦听器
                        bef = bef.filter(na => !Boolean(pre[`${na}`]));
                        setEvents(bef, mergeConfig.bind(null, pre, fn, basename));
                        return pre;
                    }
                }
                //合并至主 config 对象
                mergeConfig(pre, fn, basename)
            } catch (e) { console.error(colors['red'](`[Easy-Monitor] <${file}> config-load error: ${e.stack}`)) }
            return pre;
        }, {});
    }
github gngeorgiev / JsShell / default / config.js View on Github external
prompt() {
            const time = colors.green(new Date().toLocaleTimeString());
            const cwd = colors.cyan(shell.cwd);
            const sign = colors.yellow('$');

            const isGitRepo = fs.existsSync(path.join(shell.absoluteCwd, '.git'));
            if (isGitRepo) {
                let gitBranch = `{${shell.exec('git rev-parse --abbrev-ref HEAD')}}`;
                let isDirty = shell.exec('git status --porcelain');
                gitBranch = isDirty ? colors.red(gitBranch) : colors.green(gitBranch);
                
                
                return `${time} ${cwd} ${gitBranch} ${sign} `
            }

            return `${time} ${cwd} ${sign} `;
        },
        env() {
github Widen / cloudfront-auth / build / build.js View on Github external
required: true,
        default: R.pathOr('', ['AUTH_REQUEST', 'client_id'], oldConfig)
      },
      CLIENT_SECRET: {
        message: colors.red("Client Secret"),
        required: true,
        default: R.pathOr('', ['TOKEN_REQUEST', 'client_secret'], oldConfig)
      },
      REDIRECT_URI: {
        message: colors.red("Redirect URI"),
        required: true,
        default: R.pathOr('', ['AUTH_REQUEST', 'redirect_uri'], oldConfig)
      },
      SESSION_DURATION: {
        pattern: /^[0-9]*$/,
        description: colors.red("Session Duration (hours)"),
        message: colors.green("Entry must only contain numbers"),
        required: true,
        default: R.pathOr('', ['SESSION_DURATION'], oldConfig)/60/60
      }
    }
  }, function(err, result) {
    config.PRIVATE_KEY = fs.readFileSync('distributions/' + config.DISTRIBUTION + '/id_rsa', 'utf8');
    config.PUBLIC_KEY = fs.readFileSync('distributions/' + config.DISTRIBUTION + '/id_rsa.pub', 'utf8');
    config.DISCOVERY_DOCUMENT = result.BASE_URL + '/.well-known/openid-configuration';
    config.SESSION_DURATION = parseInt(result.SESSION_DURATION, 10) * 60 * 60;

    config.BASE_URL = result.BASE_URL;
    config.CALLBACK_PATH = url.parse(result.REDIRECT_URI).pathname;

    config.AUTH_REQUEST.client_id = result.CLIENT_ID;
    config.AUTH_REQUEST.response_type = 'code';
github chialab / rna-cli / lib / Bundlers / ScriptBundler.js View on Github external
analysis.modules.forEach((m) => {
            const size = formatBytes(m.size);
            lines.push(`${m.id.padEnd(maxLength, ' ')} ${m.reduction == 100 ? colors.red('removed by threeshake') : `${m.percent.toFixed(2).padStart(5, ' ')}% | ${colors.yellow(size.padStart(9, ' '))}${m.reduction > 0 ? colors.green(` (-${m.reduction}%)`) : ''}`}`);
        });