How to use the chalk.red function in chalk

To help you get started, we’ve selected a few chalk 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 webiny / webiny-js / scripts / build-tool / build.js View on Github external
async function prepareNpmPackage({ name, dir }) {
    try {
        await Promise.all([
            asyncCopyTo(`LICENSE`, `${destination}/${name}/LICENSE`),
            asyncCopyTo(`${dir}/package.json`, `${destination}/${name}/package.json`),

            (async () => {
                if (!existsSync(`${dir}/README.md`)) {
                    throw Error(`Missing README.md file in "${name}" package.`);
                }
                await asyncCopyTo(`${dir}/README.md`, `${destination}/${name}/README.md`);
            })()
        ]);
    } catch (e) {
        // eslint-disable-next-line
        console.log(chalk.red(e.message));
        process.exit(1);
    }

    const tgzName = (await asyncExecuteCommand(`npm pack ${destination}/${name}`)).trim();
    await asyncRimRaf(`${destination}/${name}`);
    await asyncExtractTar(getTarOptions(tgzName, name));
    unlinkSync(tgzName);
}
github typicode / husky / src / installer / bin.ts View on Github external
debug('Git rev-parse command returned:')
  debug(`  --show-top-level: ${topLevel}`)
  debug(`  --git-common-dir: ${gitCommonDir}`)

  // Install or uninstall
  if (action === 'install') {
    install(topLevel, gitCommonDir, huskyDir, isCI)
  } else {
    uninstall(gitCommonDir, huskyDir)
  }

  console.log(`husky > Done`)
} catch (error) {
  console.log(chalk.red(error.message.trim()))
  console.log(chalk.red(`husky > Failed to ${action}`))
}
github weidian-inc / bio-core / core / api / lint / run / index.js View on Github external
process.on('unhandledRejection', (reason, p) => {
            console.log('Unhandled Rejection at: Promise ', p, ' reason: ', reason);
            kill();
        });
    }

    // 初始化参数
    eslint.initParams({ ...globalParams });
    stylelint.initParams({ ...globalParams });

    // run
    console.log(green('\nrunning lint\n'));
    const eslintExitCode = eslint.exec();
    const stylelintExitCode = stylelint.exec();

    console.log(eslintExitCode ? red('eslint unpassed') : green('eslint passed!'), '; ', stylelintExitCode ? red('stylelint unpassed') : green('stylelint passed!'));
    writeStatusFile({ eslintExitCode, stylelintExitCode, statusResultSrcFile });
    ncp.copy(lintResultIndexFile, () => {
        console.log(green(`\nresult page has be created and url was copied, you can paste directly to browser address area to see result: ${lintResultIndexFile}\n`));
    });
};
github android-js / androidjs-builder / lib / updateAppName.js View on Github external
parser.parseString(data, function (err, result) {
                    if(err) {
                        reject(chalk.red('parsing error, failed to parse ')+ValuesFile);
                    } else {


                        // find and replace app name
                        for (var i = result.resources.string.length - 1; i >= 0; i--) {
                            if (result.resources.string[i]['$'].name === 'app_name') {
                                result.resources.string[i]._ = app_name;
                                console.log(result.resources.string[i]);
                            }
                        }

                        // rebuild xml from js Object
                        let xml = builder.buildObject(result);

                        fs.writeFile(ValuesFile, xml, function (err, data) {
                            if (err) throw err;
github linder0209 / generator-webpack-react / generators / app / index.js View on Github external
askForApp: function () {
      var done = this.async();

      // welcome message
      // 显示提示信息.
      this.log(yosay(
        'Welcome to the striking ' + chalk.red('WebpackReact') + ' generator!'
      ));

      var prompts = [{
        type: 'input',
        name: 'appName',
        message: 'What is the name of your app?',
        default: this.appName
      }, {
        type: 'input',
        name: 'appDescription',
        message: 'Description:',
        default: 'Create an app using WebpackReact generator with React Redux Router Webpack etc.'
      }, {
        type: 'input',
        name: 'appVersion',
        message: 'Version:',
github infinum / eightshift-boilerplate / bin / theme-setup.js View on Github external
const run = async () => {

  // Clear console
  // process.stdout.write('\033c'); // eslint-disable-line

  // Write intro
  log(chalk.red('---------------------------------------------------------------'));
  log(chalk.red(''));
  log(chalk.red('    _ _ _ ___ '));
  log(chalk.red('    | | | |__| '));
  log(chalk.red('    |_|_| |   '));
  log(chalk.red('    ___  ____ _ _    ____ ____ ___       ____ ___ ____ '));
  log(chalk.red('    |__| |  | | |    |___ |__/ |__| |    |__|  |  |___ '));
  log(chalk.red('    |__| |__| | |___ |___ |  \\ |    |___ |  |  |  |___ '));
  log(chalk.red(''));
  log(chalk.red(''));
  log('    Welcome to Boilerplate setup script for your theme!');
  log(chalk.red(''));
  log('    This script will uniquely set up your theme.');
  log(chalk.red(''));
  log(chalk.red(''));

  // Prompt user for all user data.
  let newThemeData;
  if (scriptArgs.replaceThemeInfo) {
    newThemeData = promptThemeData(scriptArgs);
  } else {
    newThemeData = promptThemeDataShort(scriptArgs);
  }
github TimeoutZero / basebuild-angular / dist / main.js View on Github external
var basebuildMainScript = function(options){
  
  var packageJSON    = require('../package.json');
  
  /*
    ==========================
    Imaginations
    ==========================
  */
  console.log('\n\n');
  console.log(' ____                 _             _     _         '  + chalk.red('_                      _            ')     );
  console.log('| __ )  __ _ ___  ___| |__  _   _(_) | __| |       '   + chalk.red('/ \\   _ __   __ _ _   _| | __ _ _ __ ')    );
  console.log('|  _ \\ / _` / __|/ _ | `_ \\| | | | | |/ _` |_____ '  + chalk.red('/ _ \\ |  `_ \\ / _`| | | | |/ _` | __|') );
  console.log('| |_) | (_| \\__ \\  __/ |_) | |_| | | | (_| |_____'   + chalk.red('/ ___ \\| | | | (_| | |_| | | (_| | |   ')  );
  console.log('|____/ \\__,_|___/\\___|_.__/ \\__,_|_|_|\\__,_|    '  + chalk.red('/_/   \\_\\_| |_|\\__, |\\__,_|_|\\__,_|_|   ') );
  console.log('                                                 '     + chalk.red('               |___/ ' + chalk.green('v' + packageJSON.version)) );    
  console.log('\n\n');

  /**
   * Config phase
   */
  var configModule   = require('./config/config.js')();
  options            = configModule.setup(options);
  var defaultOptions = options.defaultOptions;
  
  /**
   * Utils
   */
  var baseBuildUtils = require(defaultOptions.modulesData['utils'].uses)(options);
  var baseBuildName  = baseBuildUtils.getBaseBuildName();
github ng-tools / ng-factory / lib / config.js View on Github external
function loadJSON(file, options) {
  options = options || {cwd: cwd()};
  var res = {};
  var filePath = path.resolve(options.cwd, file);
  try {
    res = JSON.parse(fs.readFileSync(filePath, 'utf8'));
  } catch(err){
    log(chalk.red('Error: Failed to find file "%s"\n') +
      '        -> ' + chalk.yellow('You might want to `npm i -g generator-ng-factory; yo ng-factory` to fix this error.'), filePath);
    process.exit(1);
  }
  return res;
}
github navikt / nav-frontend-moduler / _scripts / lesshint-reporter.js View on Github external
groupedResults.forEach((group) => {
        const filepath = group.fullPath;
        const NOF_ERRORS = group.results.filter((result) => result.severity === 'error').length;
        const NOF_WARNINGS = group.results.filter((result) => result.severity === 'warning').length;

        console.log(`${filepath} (${chalk.red(NOF_ERRORS)}/${chalk.yellow(NOF_WARNINGS)})`);
        const tableRows = group.results.map((result) => [
            result.severity === 'error' ? chalk.red(' X') : chalk.yellow(' O'),
            chalk.gray(`${result.line}:${result.column}`),
            result.message,
            chalk.gray(result.linter)
        ]);
        console.log(table(tableRows, tableConfig));
        console.log('');
    });
}
github spmjs / serve-spm / lib / util.js View on Github external
if (!fs.existsSync(file)) {
    return null;
  }
  var mtime = +new Date(fs.statSync(file).mtime);
  var data = pkgCache[root];
  if (!data || data.mtime !== mtime) {
    var pkg;
    try {
      var originPkg = JSON.parse(fs.readFileSync(file, 'utf-8'));
      var args = mixarg(originPkg && originPkg.spm && originPkg.spm.buildArgs || '');
      pkg = new Package(root, {
        moduleDir: getModuleDir(root),
        skip: Object.keys(getGlobal(args.global))
      });
    } catch(e) {
      console.error(chalk.red('Package Parse Error:'), e.message);
      return null;
    }

    data = pkgCache[root] = {
      mtime: mtime,
      pkg: pkg
    };
  }
  return data.pkg;
};