How to use the kleur.red function in kleur

To help you get started, we’ve selected a few kleur 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 30-seconds / 30-seconds-of-code / scripts / module.js View on Github external
'NOBUILD'
        )} Module build terminated, not a cron job or a custom build!`
      );
      console.timeEnd('Packager');
      process.exit(0);
    }

    await doRollup();

    // Clean up the temporary input file Rollup used for building the module
    fs.unlink(ROLLUP_INPUT_FILE);

    console.log(`${green('SUCCESS!')} Snippet module built!`);
    console.timeEnd('Packager');
  } catch (err) {
    console.log(`${red('ERROR!')} During module creation: ${err}`);
    process.exit(1);
  }
}
github 30-seconds / 30-seconds-of-code / scripts / util / snippetParser.js View on Github external
});

    if (withPath) {
      // a hacky way to do conditional array.map
      return directoryFilenames.reduce((fileNames, fileName) => {
        if (
          exclude == null ||
          !exclude.some(toExclude => fileName === toExclude)
        )
          fileNames.push(`${directoryPath}/${fileName}`);
        return fileNames;
      }, []);
    }
    return directoryFilenames.filter(v => v !== 'README.md');
  } catch (err) {
    console.log(`${red('ERROR!')} During snippet loading: ${err}`);
    process.exit(1);
  }
};
// Creates a hash for a value using the SHA-256 algorithm.
github muuvmuuv / vscode-sundial / webpack.config.js View on Github external
module.exports = (_, argv) => {
  const platformName = platform()
  const developerName = userInfo().username
  const mode = argv.mode ? argv.mode : 'none'
  const isProd = mode === 'production'
  const isDev = mode === 'development'

  // Show general information
  console.log('whoIsMe:', white(developerName))
  console.log('whichOs:', white(platformName))
  console.log('devMode:', isDev ? green('true') : red('false'), '\n')

  return {
    target: 'node',
    entry: resolve(__dirname, 'src', 'extension.ts'),
    output: {
      path: resolve(__dirname, 'dist'),
      filename: 'extension.js',
      libraryTarget: 'commonjs2',
      devtoolModuleFilenameTemplate: '../[resource-path]',
    },
    devtool: isDev ? 'cheap-module-source-map' : 'source-map',
    externals: {
      // the vscode-module is created on-the-fly and must be excluded.
      // See: https://webpack.js.org/configuration/externals/
      vscode: 'commonjs vscode',
    },
github Hotell / typescript-lib-starter / scripts / init.js View on Github external
function removeItems(config) {
  log(kleur.underline().white('Removed'))

  const vsCodeDirToRemove = config.useVSCode ? null : '.vscode'
  const rmItems = /** @type {string[]} */ ([
    ...rmDirs,
    ...rmFiles,
    vsCodeDirToRemove,
  ].filter(Boolean))

  const files = rmItems.map((fileName) => resolve(ROOT, fileName))

  // 'rm' command checks the item type before attempting to remove it
  sh.rm('-rf', files)

  log(kleur.red(rmItems.join('\n')), '\n')
}
github terkelg / prompts / lib / elements / autocompleteMultiselect.js View on Github external
render() {
    if (this.closed) return;
    if (this.firstRender) this.out.write(cursor.hide);
    super.render();

    // print prompt

    let prompt = [
      style.symbol(this.done, this.aborted),
      color.bold(this.msg),
      style.delimiter(false),
      this.renderDoneOrInstructions()
    ].join(' ');

    if (this.showMinError) {
      prompt += color.red(`You must select a minimum of ${this.minSelected} choices.`);
      this.showMinError = false;
    }
    prompt += this.renderOptions(this.filteredOptions);

    this.out.write(this.clear + prompt);
    this.clear = clear(prompt);
  }
}
github moleculerjs / moleculer-web / src / index.js View on Github external
logResponse(req, res, data) {
			if (req.$route && !req.$route.logging) return;

			let time = "";
			if (req.$startTime) {
				const diff = process.hrtime(req.$startTime);
				const duration = (diff[0] + diff[1] / 1e9) * 1000;
				if (duration > 1000)
					time = kleur.red(`[+${Number(duration / 1000).toFixed(3)} s]`);
				else
					time = kleur.grey(`[+${Number(duration).toFixed(3)} ms]`);
			}
			this.logger.info(`<= ${this.coloringStatusCode(res.statusCode)} ${req.method} ${kleur.bold(req.originalUrl)} ${time}`);

			/* istanbul ignore next */
			if (this.settings.logResponseData && this.settings.logResponseData in this.logger) {
				this.logger[this.settings.logResponseData]("  Data:", data);
			}
			this.logger.info("");
		},
github adonisjs / adonis-cli / src / Services / logger.ts View on Github external
export function logError (message: string) {
  console.log(` ${red('error')}      ${message}`)
}
github preactjs / preact-cli / packages / cli / lib / util.js View on Github external
exports.error = function(text, code = 1) {
	process.stderr.write(symbols.error + red(' ERROR ') + text + '\n');
	code && process.exit(code);
};
github terkelg / prompts / lib / elements / multiselect.js View on Github external
paginateOptions(options) {
    if (options.length === 0) {
      return color.red('No matches for this query.');
    }

    let { startIndex, endIndex } = entriesToDisplay(this.cursor, options.length, this.optionsPerPage);
    let prefix, styledOptions = [];

    for (let i = startIndex; i < endIndex; i++) {
      if (i === startIndex && startIndex > 0) {
        prefix = figures.arrowUp;
      } else if (i === endIndex - 1 && endIndex < options.length) {
        prefix = figures.arrowDown;
      } else {
        prefix = ' ';
      }
      styledOptions.push(this.renderOption(this.cursor, options[i], i, prefix));
    }
github terkelg / prompts / lib / elements / number.js View on Github external
          .reduce((a, l, i) => a + `\n${i ? ` ` : figures.pointerSmall} ${color.red().italic(l)}`, ``);
    }