MCPcopy Create free account
hub / github.com/chakra-ui/park-ui / getComponentExampleSourceCode

Function getComponentExampleSourceCode

website/src/lib/source-code.ts:13–24  ·  view source on GitHub ↗
(props: Props)

Source from the content-addressed store, hash-verified

11}
12
13export const getComponentExampleSourceCode = async (props: Props) => {
14 const { component, example, framework } = props
15
16 const baseDir = join(process.cwd(), '../components')
17 const lang = 'tsx'
18
19 const fileName = `${example}.${lang}`
20 const path = join(baseDir, framework, 'src/examples', component, fileName)
21 const code = await readFile(path, 'utf-8').catch(() => null)
22
23 return code
24}

Callers 1

replaceComponentExamplesFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected