const fs = require('fs'); const path = require('path'); const translationsPath = path.join('d:', 'workspace', 'AuraK', 'web', 'utils', 'translations.ts'); let content = fs.readFileSync(translationsPath, 'utf8'); // The file should end with ja object closing and then main object closing. // Current last line: }; // end of translations // We want: // }, // }; // Strip potential trailing whitespace or comments that might mess up endsWith const lines = content.trimEnd().split('\n'); const lastLine = lines[lines.length - 1]; if (lastLine.includes('};')) { console.log('Found closing brace at the end. Fixing...'); lines[lines.length - 1] = ' },'; lines.push('};'); fs.writeFileSync(translationsPath, lines.join('\n') + '\n', 'utf8'); console.log('Fixed end of file.'); } else { console.log('Closing brace not found as expected. Last line:', lastLine); }