fix(scripts,config): Update collection i18n during reconfigure
This commit is contained in:
parent
b6d9526d8b
commit
899f468d2b
2 changed files with 20 additions and 0 deletions
9
config/templates/collection-i18n.mustache
Normal file
9
config/templates/collection-i18n.mustache
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
// Designs
|
||||||
|
{{{ designI18n }}}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Export the translations
|
||||||
|
*/
|
||||||
|
export const i18n = {
|
||||||
|
{{ designList }}
|
||||||
|
}
|
|
@ -51,6 +51,7 @@ const repo = {
|
||||||
collection: {
|
collection: {
|
||||||
pkg: readTemplateFile('collection-pkg.mustache'),
|
pkg: readTemplateFile('collection-pkg.mustache'),
|
||||||
hook: readTemplateFile('collection-hook.mustache'),
|
hook: readTemplateFile('collection-hook.mustache'),
|
||||||
|
i18n: readTemplateFile('collection-i18n.mustache'),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
contributors: SITEBUILD ? null : fs.readFileSync(path.join(root, 'CONTRIBUTORS.md'), 'utf-8'),
|
contributors: SITEBUILD ? null : fs.readFileSync(path.join(root, 'CONTRIBUTORS.md'), 'utf-8'),
|
||||||
|
@ -189,6 +190,16 @@ await writeFile(
|
||||||
designList: designList.join(',\n '),
|
designList: designList.join(',\n '),
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
|
const designI18n = designList
|
||||||
|
.map((name) => `import { i18n as ${name} } from '@freesewing/${name}'`)
|
||||||
|
.join('\n')
|
||||||
|
await writeFile(
|
||||||
|
['packages', 'collection', 'src', 'i18n.mjs'],
|
||||||
|
mustache.render(repo.templates.collection.i18n, {
|
||||||
|
designI18n,
|
||||||
|
designList: designList.join(',\n '),
|
||||||
|
})
|
||||||
|
)
|
||||||
await writeFile(
|
await writeFile(
|
||||||
['packages', 'react', 'hooks', 'useDesign', 'index.mjs'],
|
['packages', 'react', 'hooks', 'useDesign', 'index.mjs'],
|
||||||
mustache.render(repo.templates.collection.hook, {
|
mustache.render(repo.templates.collection.hook, {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue