@intlayer/chokidar
Version:
Uses chokidar to scan and build Intlayer declaration files into dictionaries based on Intlayer configuration.
18 lines (16 loc) • 677 B
JavaScript
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
const require_writeFileIfChanged = require('./writeFileIfChanged.cjs');
//#region src/writeJsonIfChanged.ts
const writeJsonIfChanged = async (path, data, { pretty = process.env.NODE_ENV === "development" } = {}) => {
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 require_writeFileIfChanged.writeFileIfChanged(path, json);
};
//#endregion
exports.writeJsonIfChanged = writeJsonIfChanged;
//# sourceMappingURL=writeJsonIfChanged.cjs.map