Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
module.exports.delete = () => { // Delete saved emoticons
try {
fs.unlinkSync(`${homeDir}/saved_emoji.txt`);
console.log(chalk.green.bold(`${logSymbols.success} Successfully deleted all saved emoticons!`));
return;
} catch (err) {
if (err.code === 'ENOENT') {
console.log(chalk.red(`${logSymbols.error} File ${homeDir}/saved_emoji.txt not found :(`));
process.exit(1);
}
}
};
.build(err => {
// Handle build errors
if (err) {
console.log(stripIndents`
${logSymbols.error} Handlebars build failed:
${chalk.red.bold(err.message)}
`);
process.exit(1);
} else {
// Handle successful build
/**
* NOTE:
* We need to backdate the generated files by ten seconds until
* https://github.com/webpack/watchpack/issues/25 is fixed.
* Otherwise we would have some unneeded rebuilds when starting webpack in
* watch mode or starting the webpack dev server.
*/
const f = path.resolve(
__dirname,
'../',
settings.destinations.handlebars
var colors = {
success: {
symbol: config.mochaReporter.symbols.success || stripAnsi(symbols.success),
print: chalk[config.mochaReporter.colors.success] || chalk.green
},
info: {
symbol: config.mochaReporter.symbols.info || stripAnsi(symbols.info),
print: chalk[config.mochaReporter.colors.info] || chalk.grey
},
warning: {
symbol: config.mochaReporter.symbols.warning || stripAnsi(symbols.warning),
print: chalk[config.mochaReporter.colors.warning] || chalk.yellow
},
error: {
symbol: config.mochaReporter.symbols.error || stripAnsi(symbols.error),
print: chalk[config.mochaReporter.colors.error] || chalk.red
}
};
// init max number of log lines
config.mochaReporter.maxLogLines = config.mochaReporter.maxLogLines || 999;
if (isNaN(config.mochaReporter.maxLogLines)) {
self.write(colors.warning.print('Option "config.mochaReporter.maxLogLines" must be of type number. Default value 999 is used!'));
config.mochaReporter.maxLogLines = 999;
}
// check if mocha is installed when showDiff is enabled
if (config.mochaReporter.showDiff) {
try {
var mocha = require('mocha');
spinner.fail = function fail(err) {
spinner.stopAndPersist(symbols.error);
// stop the rest of spinners
to.each(self.spinners, ({ value }) => {
value.originalStop();
});
self.log('error', err);
};
if (cli.input.length === 0 && cli.flags.v === true) {
cli.showVersion();
}
if (cli.input.length === 0 && cli.flags.h === true) {
cli.showHelp(0);
}
if (cli.input.length !== 1) {
console.log(`\n${logSymbols.error} Invalid input. Please check the help below:`);
cli.showHelp();
}
if (Object.keys(cli.flags).map(key => typeof cli.flags[key]).some(type => type === 'boolean')) {
console.log(`\n${logSymbols.error} Wrong option(s) provided. Please check the help below:`);
cli.showHelp();
}
errorNotifier(cli.input[0], cli.flags)
.catch(error => {
process.exit(error.code);
});
function display(plaintext) {
if (plaintext != 'Hash could not be deciphered' && plaintext != 'Hash type not supported') {
const leading = (cli.flags["plain"]) ? `` : `${logSymbols.success} `
console.log(leading + plaintext);
} else if (plaintext == 'Hash type not supported') {
const leading = (cli.flags["plain"]) ? `` : `${logSymbols.error} `
console.log(leading + `Hash type not supported`);
process.exit(1);
} else {
const leading = (cli.flags["plain"]) ? `` : `${logSymbols.error} `
console.log(leading + `Hash could not be deciphered`);
process.exit(1);
}
}
require('colors')
var
log,
symbols = require('log-symbols'),
messageTypes = {
success: symbols.success,
error: symbols.error,
info: symbols.info,
warning: symbols.warning,
debug: '[DEBUG]'.gray
}
function showMessage () {
var
array,
args = [].slice.call(arguments)
if (args[0].length === 0) {
return console.log()
}
array = [].slice.call(args[0])
export const error = (msg: string, showSymbol: boolean = true) => {
const sym = logSymbols.error;
if (showSymbol) {
msg = `${sym} ${msg} ${sym}`;
}
print('error', msg);
};
const error = message => exports.debug(`${symbols.error} ${message}`)
toString() {
const logSymbol = this.severity === 'error' ? logSymbols.error : logSymbols.warning;
const formattedLintId = chalk.gray.dim(this.lintId);
const formattedNode = chalk.gray.bold(this.node);
const formattedMessage = this.severity === 'error' ? chalk.bold.red(this.lintMessage) : chalk.yellow(this.lintMessage);
return `${logSymbol} ${formattedLintId} - node: ${formattedNode} - ${formattedMessage}`;
}
}