@intlayer/chokidar
Version:
Uses chokidar to scan and build Intlayer declaration files into dictionaries based on Intlayer configuration.
17 lines (15 loc) • 516 B
JavaScript
import { writeFileIfChanged } from "./writeFileIfChanged.mjs";
//#region src/writeJsonIfChanged.ts
const writeJsonIfChanged = async (path, data, { pretty = true } = {}) => {
const space = pretty ? 2 : void 0;
let json = "{}";
try {
json = JSON.stringify(data, null, space);
} catch (error) {
console.error(`Error while parsing data to JSON for ${path}:`, error);
}
return await writeFileIfChanged(path, json);
};
//#endregion
export { writeJsonIfChanged };
//# sourceMappingURL=writeJsonIfChanged.mjs.map