How to use the colors-cli/safe.yellow function in colors-cli

To help you get started, we’ve selected a few colors-cli 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 kktjs / kkt-ssr / utils / loadConfig.js View on Github external
module.exports = (conf, { kktrc, ...optionConf }, webpack) => {
  if (kktrc && kktrc.config && typeof kktrc.config === 'function') {
    conf = kktrc.config(conf, optionConf, webpack) || conf;
  } else if (kktrc && kktrc.config) {
    console.log(color.yellow('Check for .kkt.conf.js file, kktrc.config is not a function.')); // eslint-disable-line
  }
  if (kktrc && kktrc.plugins && kktrc.plugins.length > 0) {
    kktrc.plugins.forEach((item) => {
      const plugin = require(item); // eslint-disable-line
      conf = plugin(conf, optionConf, webpack) || conf;
    });
  }
  return conf;
};
github jaywcjlove / mocker-api / bin / mocker.js View on Github external
#!/usr/bin/env node
const path = require('path');
const prepareUrls = require('local-ip-url/prepareUrls');
const detect = require('detect-port');
const color = require('colors-cli/safe');
const express = require('express');
const apiMocker = require('../');

if (!process.argv.slice(2).length) {
  console.log(color.red('Error: Need to pass parameters!'));
  console.log(`E.g: ${color.yellow('mocker ')}\n`);
  return;
}
let mockpath = process.argv[2];

mockpath = require.resolve(path.resolve(mockpath));

(async () => {
  const HOST = process.env.HOST || '0.0.0.0';
  let DEFAULT_PORT = parseInt(process.env.PORT, 10) || 3721;
  const PORT = await detect(DEFAULT_PORT);

  if (DEFAULT_PORT !== PORT) {
    DEFAULT_PORT = PORT;
  }
  process.env.PORT = DEFAULT_PORT;
  const app = express();
github kktjs / kkt / .bin / kkt.js View on Github external
.action((cmd) => {
    program.outputHelp()
    logs(`  ` + colors.red(`Unknown command ${colors.yellow(cmd)}.`))
    logs()
  })