UNPKG

@intlayer/chokidar

Version:

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

29 lines (27 loc) 933 B
import { rm } from "node:fs/promises"; import { getAppLogger } from "@intlayer/config/logger"; import { existsSync } from "node:fs"; //#region src/cleanOutputDir.ts const cleanOutputDir = async (configuration) => { const { dictionariesDir, unmergedDictionariesDir, dynamicDictionariesDir, remoteDictionariesDir, fetchDictionariesDir, mainDir, typesDir, configDir, cacheDir } = configuration.system; const appLogger = getAppLogger(configuration); const directoriesToClean = [ dictionariesDir, unmergedDictionariesDir, dynamicDictionariesDir, remoteDictionariesDir, fetchDictionariesDir, mainDir, typesDir, configDir, cacheDir ]; await Promise.all(directoriesToClean.filter((dir) => existsSync(dir)).map((dir) => rm(dir, { recursive: true, force: true }))); appLogger("Output directory cleaned", { isVerbose: true }); }; //#endregion export { cleanOutputDir }; //# sourceMappingURL=cleanOutputDir.mjs.map