UNPKG

@manypkg/cli

Version:

Manypkg is a linter for `package.json` files in Yarn, npm, Lerna, pnpm or Rush monorepos.

34 lines (30 loc) 829 B
import pc from "picocolors"; import util from "node:util"; function format( args: Array<any>, messageType: "error" | "success" | "info", scope?: string ) { let prefix = { error: pc.red("error"), success: pc.green("success"), info: pc.cyan("info"), }[messageType]; let fullPrefix = "☔️ " + prefix + (scope === undefined ? "" : " " + scope); return ( fullPrefix + util .format("", ...args) .split("\n") .join("\n" + fullPrefix + " ") ); } export function error(message: string, scope?: string) { console.error(format([message], "error", scope)); } export function success(message: string, scope?: string) { console.log(format([message], "success", scope)); } export function info(message: string, scope?: string) { console.log(format([message], "info", scope)); }