Skip to content

Commit

Permalink
generated/components.json - includes link to component code on GitHub (
Browse files Browse the repository at this point in the history
  • Loading branch information
mperrotti authored Dec 3, 2024
1 parent e231b5f commit 00da88a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
6 changes: 5 additions & 1 deletion packages/react/script/components-json/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ type Component = {
| '@primer/react/experimental'
| '@primer/react/drafts'
stories: Array<{id: string; code?: string}>
source?: string
}

const ajv = new Ajv()
Expand Down Expand Up @@ -114,7 +115,10 @@ const components = docsFiles.map(docsFilepath => {
}

// TODO: Provide default type and description for sx and ref props
return docs
return {
source: `https://github.com/primer/react/tree/main/packages/react/${docsFilepath.substring(0, docsFilepath.lastIndexOf('/'))}`,
...docs,
}
})

const data = {schemaVersion: 2, components: keyBy(components, 'id')}
Expand Down
4 changes: 4 additions & 0 deletions packages/react/script/components-json/component.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,10 @@
"type": "string",
"description": "The path to import the component from. i.e. '@primer/react/experimental'"
},
"source": {
"type": "string",
"description": "Link to the component source on GitHub"
},

"stories": {
"type": "array",
Expand Down

0 comments on commit 00da88a

Please sign in to comment.