/** * Colors the CLI text in green. */ export const green = (text: string): string => `\u001b[32m${text}\u001b[39m`; /** * Colors the CLI text in red. */ export const red = (text: string): string => `\u001b[31m${text}\u001b[39m`; /** * Returns a readable timestamp in current locale time, e.g. `[2021-05-13 13:02:12.685]` */ export const getTimestamp = (): string => { const offset = new Date().getTimezoneOffset() * 60000; //offset in milliseconds const localISOTime = new Date(Date.now() - offset) .toISOString() .slice(0, -1) .replace('T', ' '); return `[${localISOTime}]`; };