import chalk from 'chalk' ; import ora from 'ora' ; import readline from 'readline' ; const brandColor = '7ca2ff' ; const withBrand = ( str ) => { return chalk . hex ( brandColor ) . bold ( str ) ; } ; const withWarning = ( str ) => { return `⚠️  ${ chalk . yellow ( str ) }` ; } ; const withCaret = ( str ) => { return `${ chalk . gray ( '>' ) } ${ str }` ; } ; const withCheck = ( str ) => { return `${ chalk . green ( '✔' ) } ${ str }` ; } ; const withX = ( str ) => { return `${ chalk . red . bold ( '✕' ) } ${ str }` ; } ; param { string } msg const branded = ( msg ) => { console . log ( chalk . hex ( brandColor ) . bold ( msg ) ) ; } ; param { string } msg const clearLine = ( msg ? ) => { readline . clearLine ( process . stdout , 0 ) ; readline . cursorTo ( process . stdout , 0 ) ; msg && process . stdout . write ( msg ) ; } ; param { string } msg const warning = ( msg ) => { console . log ( withCaret ( withWarning ( msg ) ) ) ; } ; param { string } msg const error = ( msg ) => { console . error ( withX ( chalk . red . bold ( msg ) ) ) ; } ; param { string } msg const meta = ( msg ) => { console . log ( withCaret ( chalk . gray ( msg ) ) ) ; } ; param { string } msg const progress = ( msg ) => { console . log ( withCaret ( chalk . bold ( msg ) ) ) ; } ; const info = ( msg ) => { console . log ( chalk . bold ( msg ) ) ; } ; const spinner = ( str ) => { return ora ( { text : str , color : 'blue' , spinner : { interval : 120 , frames : [ '◢' , '◣' , '◤' , '◥' ] } } ) ; } ; param { string } msg const success = ( msg ) => { console . log ( withCheck ( chalk . green ( msg ) ) ) ; } ; const newline = ( ) => { console . log ( ' ' ) ; } ; param { string } val const variable = ( val ) => { return chalk . cyan . bold ( `${ val }` ) ; } ; param str const debug = ( str ) => { process . env . DEBUG && console . log ( str ) ; } ; export const log = { withBrand , withWarning , withCaret , withCheck , withX , branded , clearLine , error , warning , meta , progress , spinner , success , newline , variable , info , debug } ;