11import {
2+ copyFileSync ,
23 existsSync ,
34 mkdirSync ,
45 readdirSync ,
@@ -51,6 +52,7 @@ export function buildComponents() {
5152 const componentPath = join ( typePath , componentName ) ;
5253 const metadataPath = join ( componentPath , 'metadata.json' ) ;
5354 const htmlPath = join ( componentPath , 'index.html' ) ;
55+ const previewPath = join ( componentPath , 'preview.png' ) ;
5456
5557 if ( existsSync ( metadataPath ) && existsSync ( htmlPath ) ) {
5658 try {
@@ -65,6 +67,11 @@ export function buildComponents() {
6567 // Write HTML file to dist
6668 writeFileSync ( join ( distPath , type , `${ metadata . id } .html` ) , html ) ;
6769
70+ // Copy preview.png file if it exists
71+ if ( existsSync ( previewPath ) ) {
72+ copyFileSync ( previewPath , join ( distPath , type , `${ metadata . id } .png` ) ) ;
73+ }
74+
6875 console . log ( `✓ Built ${ type } /${ metadata . id } ` ) ;
6976 } catch ( error ) {
7077 console . error ( `✗ Error building ${ type } /${ componentName } :` , error ) ;
@@ -77,12 +84,12 @@ export function buildComponents() {
7784 // Helper function to create paginated files
7885 function createPaginatedFiles ( items : ComponentMetadata [ ] , type : string ) {
7986 const totalPages = Math . ceil ( items . length / ITEMS_PER_PAGE ) ;
80-
87+
8188 for ( let page = 1 ; page <= totalPages ; page ++ ) {
8289 const startIndex = ( page - 1 ) * ITEMS_PER_PAGE ;
8390 const endIndex = startIndex + ITEMS_PER_PAGE ;
8491 const pageItems = items . slice ( startIndex , endIndex ) ;
85-
92+
8693 const paginatedData : PaginatedOutput = {
8794 items : pageItems ,
8895 page : page ,
0 commit comments