fix: removing obsolete component listing file

This commit is contained in:
LOUIS POTEVIN
2026-06-04 11:36:18 +02:00
parent 3cdb0b709e
commit dd48a02e3b
-42
View File
@@ -1,42 +0,0 @@
/**
* Scans src/components/ and regenerates src/components/index.ts.
* Each component folder must have an index.ts that exports the component.
* Run: npm run barrel
*/
import { readdir, writeFile, stat } from 'fs/promises';
import { join, resolve } from 'path';
import { fileURLToPath } from 'url';
const __dirname = fileURLToPath(new URL('.', import.meta.url));
const componentsDir = resolve(__dirname, '../src/components');
const outputFile = join(componentsDir, 'index.ts');
const entries = await readdir(componentsDir);
const componentFolders = (
await Promise.all(
entries.map(async (name) => {
const fullPath = join(componentsDir, name);
const info = await stat(fullPath);
return info.isDirectory() ? name : null;
})
)
).filter(Boolean);
if (componentFolders.length === 0) {
console.log('No component folders found.');
process.exit(0);
}
const lines = [
'// Auto-generated by scripts/generate-barrel.mjs — do not edit manually.',
'',
...componentFolders.map((name) => `export * from './${name}/index.ts';`),
'',
];
await writeFile(outputFile, lines.join('\n'), 'utf-8');
console.log(`Barrel generated with ${componentFolders.length} component(s):`);
componentFolders.forEach((name) => console.log(` - ${name}`));