@lucidcms/core
Version:
The core of the Lucid CMS. It's responsible for spinning up the API and serving the CMS.
2 lines • 925 B
JavaScript
import e from"../../constants/constants.mjs";import t from"../../utils/errors/lucid-error.mjs";import{loadTranslationSources as n}from"./load-project-translations.mjs";import{createTranslationStore as r}from"./store.mjs";import{mkdir as i,writeFile as a}from"node:fs/promises";import o from"node:path";const s=async n=>{try{await i(n.outputPath,{recursive:!0}),await a(o.join(n.outputPath,e.i18n.renderedOutput),JSON.stringify(n.translationStore.bundles,null,2))}catch(e){throw new t({message:e instanceof Error?e.message:`Lucid failed to write the translation artifact.`})}},c=async e=>{let t=r({defaultLocale:e.config.i18n.defaultLocale,bundles:e.bundles??await n({projectRoot:e.projectRoot,sources:e.config.i18n.sources})});return e.outputPath&&await s({translationStore:t,outputPath:e.outputPath}),{translationStore:t}};export{c as default,s as writeTranslationArtifact};
//# sourceMappingURL=prepare-translations.mjs.map