import fs from "fs"; import { syncIntlFormatMessage } from "./syncIntlFormatMessage"; export function syncFile({ path, translations, }: { path: string; translations: Record; }) { if (!fs.existsSync(path)) { throw new Error(`File not found: ${path}`); } const content = fs.readFileSync(path, "utf-8"); const { fileContent, updated } = syncIntlFormatMessage({ translations, fileContent: content, }); if (updated) { fs.writeFileSync(path, fileContent, "utf-8"); } return { updated, fileContent }; }