How to use the colors-cli/safe.red 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 / conf / jest.config.js View on Github external
'transformIgnorePatterns',
    'reporters',
  ];
  if (overrides) {
    supportedKeys.forEach((key) => {
      // eslint-disable-next-line
      if (overrides.hasOwnProperty(key)) {
        config[key] = overrides[key];
        delete overrides[key];
      }
    });
    const unsupportedKeys = Object.keys(overrides);
    if (unsupportedKeys.length) {
      /* eslint-disable */
      console.error(
        color.red(
          'Out of the box, kkt-ssr only supports overriding ' +
          'these Jest options:\n\n' +
          supportedKeys.map(key => color.bold('  \u2022 ' + key)).join('\n') +
          '.\n\n' +
          'These options in your package.json Jest configuration ' +
          'are not currently supported by kkt-ssr:\n\n' +
          unsupportedKeys.map(key => color.bold('  \u2022 ' + key)).join('\n')
        )
      );
      /* eslint-enable */
      process.exit(1);
    }
  }
  return config;
};
github kktjs / kkt / conf / jest.config.js View on Github external
'transformIgnorePatterns',
    'reporters',
  ];
  if (overrides) {
    supportedKeys.forEach((key) => {
      // eslint-disable-next-line
      if (overrides.hasOwnProperty(key)) {
        config[key] = overrides[key];
        delete overrides[key];
      }
    });
    const unsupportedKeys = Object.keys(overrides);
    if (unsupportedKeys.length) {
      /* eslint-disable */
      console.error(
        color.red(
          'Out of the box, kkt only supports overriding ' +
          'these Jest options:\n\n' +
          supportedKeys.map(key => color.bold('  \u2022 ' + key)).join('\n') +
          '.\n\n' +
          'These options in your package.json Jest configuration ' +
          'are not currently supported by kkt:\n\n' +
          unsupportedKeys.map(key => color.bold('  \u2022 ' + key)).join('\n')
        )
      );
      /* eslint-enable */
      process.exit(1);
    }
  }
  return config;
};
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;