diff --git a/src/messages/_default.json b/src/messages/_default.json index e7b9a3c79..b1dd20fd7 100644 --- a/src/messages/_default.json +++ b/src/messages/_default.json @@ -63,4 +63,4 @@ "src/components/Navigation/Navigation.js" ] } -] \ No newline at end of file +] diff --git a/src/messages/cs.json b/src/messages/cs.json index 9c3d32764..08efe1785 100644 --- a/src/messages/cs.json +++ b/src/messages/cs.json @@ -63,4 +63,4 @@ "src/components/Navigation/Navigation.js" ] } -] \ No newline at end of file +] diff --git a/src/messages/en.json b/src/messages/en.json index e7b9a3c79..b1dd20fd7 100644 --- a/src/messages/en.json +++ b/src/messages/en.json @@ -63,4 +63,4 @@ "src/components/Navigation/Navigation.js" ] } -] \ No newline at end of file +] diff --git a/tools/extractMessages.js b/tools/extractMessages.js index a82a53fa5..ca77ecf7c 100644 --- a/tools/extractMessages.js +++ b/tools/extractMessages.js @@ -19,6 +19,10 @@ const GLOB_PATTERN = 'src/**/*.{js,jsx}'; const fileToMessages = {}; let messages = {}; +async function writeMessages(fileName, messages) { + await fs.writeFile(fileName, JSON.stringify(messages, null, 2) + '\n'); +} + // merge messages to source files async function mergeToFile(locale, toBuild) { const fileName = `src/messages/${locale}.json`; @@ -56,14 +60,14 @@ async function mergeToFile(locale, toBuild) { .map(key => originalMessages[key]) .filter(msg => msg.files || msg.message); - await fs.writeFile(fileName, JSON.stringify(result, null, 2)); + await writeMessages(fileName, result); console.log(`Messages updated: ${fileName}`); if (toBuild && locale !== '_default') { const buildFileName = `build/messages/${locale}.json`; try { - await fs.writeFile(buildFileName, JSON.stringify(result, null, 2)); + await writeMessages(buildFileName, result); console.log(`Build messages updated: ${buildFileName}`); } catch (err) { console.error(`Failed to update ${buildFileName}`);