@@ -23,6 +23,7 @@ const FILE_EXTENSIONS = {
2323 EXAMPLE : ".example.tsx" ,
2424 TEST_PATTERN : ".test." ,
2525 INDEX : "/index.tsx" ,
26+ CATEGORY_CONFIG : "_category_.json" ,
2627} as const ;
2728
2829const COMPONENT_PATTERNS = {
@@ -557,7 +558,8 @@ function main() {
557558 // Create output directory if it doesn't exist
558559 fs . mkdirSync ( outputDir , { recursive : true } ) ;
559560
560- // Delete only subdirectories (preserve files like index.md)
561+ // Delete only subdirectories (preserve root-level files)
562+ // This preserves files like _index.md (category link) and styling.md (manual docs)
561563 if ( fs . existsSync ( outputDir ) ) {
562564 const entries = fs . readdirSync ( outputDir , { withFileTypes : true } ) ;
563565 for ( const entry of entries ) {
@@ -576,6 +578,32 @@ function main() {
576578 fs . mkdirSync ( dataOutputDir , { recursive : true } ) ;
577579 fs . mkdirSync ( uiOutputDir , { recursive : true } ) ;
578580
581+ // Create _category_.json files for proper sidebar labels
582+ fs . writeFileSync (
583+ path . join ( uiOutputDir , FILE_EXTENSIONS . CATEGORY_CONFIG ) ,
584+ `${ JSON . stringify (
585+ {
586+ label : "UI components" ,
587+ position : 2 ,
588+ } ,
589+ null ,
590+ 2 ,
591+ ) } \n`,
592+ MARKDOWN . FILE_ENCODING ,
593+ ) ;
594+ fs . writeFileSync (
595+ path . join ( dataOutputDir , FILE_EXTENSIONS . CATEGORY_CONFIG ) ,
596+ `${ JSON . stringify (
597+ {
598+ label : "Data components" ,
599+ position : 3 ,
600+ } ,
601+ null ,
602+ 2 ,
603+ ) } \n`,
604+ MARKDOWN . FILE_ENCODING ,
605+ ) ;
606+
579607 let count = 0 ;
580608
581609 const fileNameCounts = new Map < string , number > ( ) ;
0 commit comments