File tree Expand file tree Collapse file tree 2 files changed +4
-2
lines changed Expand file tree Collapse file tree 2 files changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -4,13 +4,15 @@ type Component = {
44 id : string
55 name : string
66 importPath : string
7+ slug : string
78}
89
910const components : Array < Component > = Object . entries ( componentsMetadata . components ) . map ( ( [ id , component ] ) => {
1011 return {
1112 id,
1213 name : component . name ,
1314 importPath : component . importPath ,
15+ slug : id . replaceAll ( '_' , '-' ) ,
1416 }
1517} )
1618
Original file line number Diff line number Diff line change @@ -43,7 +43,7 @@ server.tool(
4343 async ( { name} ) => {
4444 const components = listComponents ( )
4545 const match = components . find ( component => {
46- return component . name === name
46+ return component . name === name || component . name . toLowerCase ( ) === name . toLowerCase ( )
4747 } )
4848 if ( ! match ) {
4949 return {
@@ -56,7 +56,7 @@ server.tool(
5656 }
5757 }
5858
59- const url = new URL ( `/product/components/${ match . id } ` , 'https://primer.style' )
59+ const url = new URL ( `/product/components/${ match . slug } ` , 'https://primer.style' )
6060 const response = await fetch ( url )
6161 if ( ! response . ok ) {
6262 throw new Error ( `Failed to fetch ${ url } : ${ response . statusText } ` )
You can’t perform that action at this time.
0 commit comments