@shibi-snowball/c3-shared
Version:
51 lines (41 loc) • 870 B
JavaScript
import chalk from 'chalk'
import { getAsciiArtText } from './helpers.js'
const exit = () => {
process.exit(1)
}
const logEmptyLine = () => {
console.log('')
}
const logErrorWithoutExiting = (msg) => {
logEmptyLine()
console.log(chalk.bold.red(msg))
}
const logError = (msg) => {
logErrorWithoutExiting(msg)
exit() // Kill the app if this method is invoked.
}
const logWarning = (msg) => {
logEmptyLine()
console.log(chalk.hex('#FFA500')(msg))
}
const logMessage = (msg) => {
logEmptyLine()
console.log(msg)
}
const logSuccess = (msg) => {
logEmptyLine()
console.log(chalk.green.bold(msg))
}
const logAsciiArt = () => {
const asciiArt = getAsciiArtText()
logMessage(asciiArt)
}
export {
logError,
logWarning,
logMessage,
logSuccess,
logAsciiArt,
logErrorWithoutExiting,
exit,
}