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 = {
4
4
id : string
5
5
name : string
6
6
importPath : string
7
+ slug : string
7
8
}
8
9
9
10
const components : Array < Component > = Object . entries ( componentsMetadata . components ) . map ( ( [ id , component ] ) => {
10
11
return {
11
12
id,
12
13
name : component . name ,
13
14
importPath : component . importPath ,
15
+ slug : id . replaceAll ( '_' , '-' ) ,
14
16
}
15
17
} )
16
18
Original file line number Diff line number Diff line change @@ -43,7 +43,7 @@ server.tool(
43
43
async ( { name} ) => {
44
44
const components = listComponents ( )
45
45
const match = components . find ( component => {
46
- return component . name === name
46
+ return component . name === name || component . name . toLowerCase ( ) === name . toLowerCase ( )
47
47
} )
48
48
if ( ! match ) {
49
49
return {
@@ -56,7 +56,7 @@ server.tool(
56
56
}
57
57
}
58
58
59
- const url = new URL ( `/product/components/${ match . id } ` , 'https://primer.style' )
59
+ const url = new URL ( `/product/components/${ match . slug } ` , 'https://primer.style' )
60
60
const response = await fetch ( url )
61
61
if ( ! response . ok ) {
62
62
throw new Error ( `Failed to fetch ${ url } : ${ response . statusText } ` )
You can’t perform that action at this time.
0 commit comments