Skip to content

Commit 5c764dd

Browse files
committed
fix(website): resolve an issue that some examples could not be resolved. closes #541
1 parent 8829e87 commit 5c764dd

2 files changed

Lines changed: 4 additions & 2 deletions

File tree

website/next-env.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/// <reference types="next" />
22
/// <reference types="next/image-types/global" />
3-
import './.next/types/routes.d.ts'
3+
import './.next/dev/types/routes.d.ts'
44

55
// NOTE: This file should not be edited
66
// see https://nextjs.org/docs/app/api-reference/config/typescript for more information.

website/src/app/docs/actions.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ interface Props {
1414
name: string
1515
}
1616

17+
const toKebabCase = (str: string) => str.replace(/([a-z0-9])([A-Z])/g, '$1-$2').toLowerCase()
18+
1719
export const getComponentSourceCode = async (props: Props): Promise<FrameworkSourceCode[]> => {
1820
const { component, name } = props
1921

@@ -22,7 +24,7 @@ export const getComponentSourceCode = async (props: Props): Promise<FrameworkSou
2224
return Promise.all(
2325
frameworkConfigs.map(async ({ framework, lang }) => {
2426
const fileName = `${name}.${lang}`
25-
const path = join(baseDir, framework, 'src/examples', component, fileName)
27+
const path = join(baseDir, framework, 'src/examples', component, toKebabCase(fileName))
2628
const code = await readFile(path, 'utf-8').catch(() => null)
2729

2830
return {

0 commit comments

Comments
 (0)