mirror of
https://github.com/yewstack/yew.git
synced 2025-12-08 21:26:25 +00:00
* add prettier * ci * run prettier * run prettier in CI * run prettier --write * ignore README.md * specify googleAnalytics * fmt * npm run write-translations * fmt * ignore i18n json files they're autogenerated and don't like being formatted * post merge fixes & some updates * post merge fixes
30 lines
752 B
JavaScript
30 lines
752 B
JavaScript
const {
|
|
i18n: { locales },
|
|
} = require('./docusaurus.config.js')
|
|
const util = require('util')
|
|
const exec = util.promisify(require('child_process').exec)
|
|
|
|
/**
|
|
* @param {string} locale
|
|
*/
|
|
async function writeTranslation(locale) {
|
|
// exec rejects when the subprocess exits with non-zero code
|
|
const { stdout, stderr } = await exec(
|
|
`npm run docusaurus -- write-translations --locale ${locale}`
|
|
)
|
|
console.log(stdout)
|
|
console.error(stderr)
|
|
}
|
|
|
|
async function writeTranslations() {
|
|
for (const locale of locales.filter((locale) => locale !== 'en')) {
|
|
await writeTranslation(locale)
|
|
}
|
|
}
|
|
|
|
module.exports = writeTranslations
|
|
|
|
if (require.main === module) {
|
|
writeTranslations().catch((e) => console.error(e))
|
|
}
|