import * as colors from 'colors' ; import * as ora from 'ora' ; import * as signale from 'signale' ; export function logText ( ... message ) { console . log ( ... message ) ; } export function logWarn ( message ) { signale . warn ( message ) ; } export function logFatal ( message ) { signale . fatal ( message ) ; process . exit ( 1 ) ; } export function logInfo ( message ) { signale . info ( message ) ; } export function logAwait ( message ) { signale . await ( message ) ; } export function logComplete ( message ) { signale . complete ( message ) ; } export function logSuccess ( message ) { signale . success ( message ) ; } export async function spinner < T > ( message , fn ) { const oraSpinner = ora ( colors . green ( message ) ) . start ( ) ; let errorMessage = null ; function runError ( customMessage ) { errorMessage = customMessage ; } try { const result = await fn ( runError ) ; if ( errorMessage ) { oraSpinner . fail ( colors . red ( errorMessage ) ) ; return null ; } oraSpinner . succeed ( colors . green ( message ) ) ; return result ; } catch ( error ) { signale . fatal ( error ) ; return process . exit ( 0 ) ; } }