UNPKG

@intlayer/chokidar

Version:

Uses chokidar to scan and build Intlayer declaration files into dictionaries based on Intlayer configuration.

14 lines (12 loc) 885 B
import { relative } from "node:path"; import { colorize, colorizePath } from "@intlayer/config/logger"; import * as ANSIColors from "@intlayer/config/colors"; import { system } from "@intlayer/config/built"; import { getLocaleName } from "@intlayer/core/localization"; import { ENGLISH } from "@intlayer/types/locales"; //#region src/utils/formatter.ts const formatPath = (path, color) => [path].flat().map((path) => path.startsWith("/") ? relative(system.baseDir, path) : path).map((relativePath) => color === false ? relativePath : colorizePath(relativePath, color)).join(`, `); const formatLocale = (locale, color = ANSIColors.GREEN) => [locale].flat().map((locale) => `${getLocaleName(locale, ENGLISH)} (${locale})`).map((text) => color === false ? text : colorize(text, color)).join(`, `); //#endregion export { formatLocale, formatPath }; //# sourceMappingURL=formatter.mjs.map