@intlayer/chokidar
Version:
Uses chokidar to scan and build Intlayer declaration files into dictionaries based on Intlayer configuration.
1 lines • 1.42 kB
Source Map (JSON)
{"version":3,"file":"getBuiltRemoteDictionariesPath.cjs","names":["fg"],"sources":["../../../src/createDictionaryEntryPoint/getBuiltRemoteDictionariesPath.ts"],"sourcesContent":["import { existsSync } from 'node:fs';\nimport { mkdir } from 'node:fs/promises';\nimport { basename } from 'node:path';\nimport { normalizePath } from '@intlayer/config/utils';\nimport type { IntlayerConfig } from '@intlayer/types/config';\nimport fg from 'fast-glob';\n\n/**\n * This function generates a list of dictionaries in the main directory\n */\nexport const getBuiltRemoteDictionariesPath = async (\n configuration: IntlayerConfig,\n excludeKeys: string[] = []\n) => {\n const { remoteDictionariesDir, mainDir } = configuration.system;\n\n // Create main directory if it doesn't exist\n if (!existsSync(mainDir)) {\n await mkdir(mainDir, { recursive: true });\n }\n\n const dictionariesPath: string[] = fg.sync(\n `${normalizePath(remoteDictionariesDir)}/**/*.json`\n );\n\n return dictionariesPath.filter((path) => {\n const key = basename(path, '.json');\n return !excludeKeys.includes(key);\n });\n};\n"],"mappings":";;;;;;;;;;;;;AAUA,MAAa,iCAAiC,OAC5C,eACA,cAAwB,CAAC,MACtB;CACH,MAAM,EAAE,uBAAuB,YAAY,cAAc;CAGzD,IAAI,yBAAY,OAAO,GACrB,kCAAY,SAAS,EAAE,WAAW,KAAK,CAAC;CAO1C,OAJmCA,kBAAG,KACpC,6CAAiB,qBAAqB,EAAE,WAGpB,EAAE,QAAQ,SAAS;EACvC,MAAM,8BAAe,MAAM,OAAO;EAClC,OAAO,CAAC,YAAY,SAAS,GAAG;CAClC,CAAC;AACH"}