@@ -166,39 +166,6 @@ async function processLocaleFiles(locale, baseComponents, englishFiles) {
166166 }
167167}
168168
169- async function processLocaleFiles ( locale , baseComponents ) {
170- const localeDir = path . join ( LOCALES_BASE_DIR , locale ) ;
171- const localeOutputDir = path . join ( OUTPUT_DIR , locale ) ;
172- await fs . mkdir ( localeOutputDir , { recursive : true } ) ;
173-
174- // Load locale-specific reusable component overrides
175- const components = { ...baseComponents } ;
176- const localeReusableDir = path . join ( localeDir , 'reusable' ) ;
177- try {
178- const files = await fs . readdir ( localeReusableDir ) ;
179- for ( const file of files ) {
180- if ( file . endsWith ( '.md' ) || file . endsWith ( '.mdx' ) ) {
181- const content = await fs . readFile ( path . join ( localeReusableDir , file ) , 'utf-8' ) ;
182- const cleanedContent = content . replace ( / < ! - - - .* ?- - - > \s * \n ? / gs, '' ) . trim ( ) ;
183- const componentName = toPascalCase ( file . replace ( / \. ( m d | m d x ) $ / , '' ) ) ;
184- components [ componentName ] = cleanedContent ;
185- }
186- }
187- } catch { /* no locale-specific reusable overrides */ }
188-
189- const entries = await fs . readdir ( localeDir , { withFileTypes : true } ) ;
190- for ( const entry of entries ) {
191- if ( ! entry . isFile ( ) || ( ! entry . name . endsWith ( '.md' ) && ! entry . name . endsWith ( '.mdx' ) ) ) continue ;
192-
193- const rawContent = await fs . readFile ( path . join ( localeDir , entry . name ) , 'utf-8' ) ;
194- let content = cleanFrontmatter ( rawContent ) ;
195- content = stripContent ( content , components ) ;
196-
197- const basename = entry . name . replace ( / \. ( m d | m d x ) $ / , '' ) ;
198- await fs . writeFile ( path . join ( localeOutputDir , `${ basename } .md` ) , content , 'utf-8' ) ;
199- }
200- }
201-
202169async function main ( ) {
203170 console . log ( 'Starting Markdown generation...' ) ;
204171
@@ -218,16 +185,6 @@ async function main() {
218185 }
219186 } catch { /* no locales directory */ }
220187
221- // Generate .md files for each locale
222- try {
223- const localeEntries = await fs . readdir ( LOCALES_BASE_DIR , { withFileTypes : true } ) ;
224- const locales = localeEntries . filter ( e => e . isDirectory ( ) && ! e . name . startsWith ( '.' ) ) . map ( e => e . name ) ;
225- for ( const locale of locales ) {
226- await processLocaleFiles ( locale , reusableComponents ) ;
227- console . log ( `Locale markdown generated: ${ locale } ` ) ;
228- }
229- } catch { /* no locales directory */ }
230-
231188 console . log ( 'Markdown generation complete.' ) ;
232189}
233190
0 commit comments