Skip to main content
Glama
listContentDeclaration.ts1.59 kB
import { relative } from 'node:path'; import { formatPath } from '@intlayer/chokidar'; import { colon, colorizeKey, colorizeNumber, type GetConfigurationOptions, getAppLogger, getConfiguration, } from '@intlayer/config'; import { getUnmergedDictionaries } from '@intlayer/unmerged-dictionaries-entry'; type ListContentDeclarationOptions = { configOptions?: GetConfigurationOptions; }; export const listContentDeclarationRows = ( options?: ListContentDeclarationOptions ) => { const config = getConfiguration(options?.configOptions); const unmergedDictionariesRecord = getUnmergedDictionaries(config); const rows = Object.values(unmergedDictionariesRecord) .flat() .map((dictionary) => ({ key: dictionary.key ?? '', path: relative(config.content.baseDir, dictionary.filePath ?? 'Remote'), })); return rows; }; export const listContentDeclaration = ( options?: ListContentDeclarationOptions ) => { const config = getConfiguration(options?.configOptions); const appLogger = getAppLogger(config, { config: { prefix: '', }, }); const rows = listContentDeclarationRows(options); const lines = rows.map((row) => [ colon(` - ${colorizeKey(row.key)}`, { colSize: rows.map((row) => row.key.length), maxSize: 60, }), ' - ', formatPath(row.path), ].join('') ); appLogger(`Content declaration files:`); lines.forEach((line) => { appLogger(line, { level: 'info', }); }); appLogger(`Total content declaration files: ${colorizeNumber(rows.length)}`); };

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/aymericzip/intlayer'

If you have feedback or need assistance with the MCP directory API, please join our Discord server