Skip to content

Commit 23dde6e

Browse files
committed
Remove unused locale processing logic in Markdown generation script
1 parent c1bf2e9 commit 23dde6e

1 file changed

Lines changed: 0 additions & 43 deletions

File tree

scripts/generate-md.mjs

Lines changed: 0 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -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(/\.(md|mdx)$/, ''));
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(/\.(md|mdx)$/, '');
198-
await fs.writeFile(path.join(localeOutputDir, `${basename}.md`), content, 'utf-8');
199-
}
200-
}
201-
202169
async 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

Comments
 (0)