Skip to content
This repository was archived by the owner on Nov 21, 2025. It is now read-only.

Commit 9606a59

Browse files
committed
fix(docz-core): better default filterComponents
#1224 Parses files that match at least one of these criteria : - starts with a capital letter - is called index - has a jsx or tsx extension
1 parent e500aa1 commit 9606a59

1 file changed

Lines changed: 8 additions & 3 deletions

File tree

core/docz-core/src/config/docz.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,14 @@ export const doczRcBaseConfig = {
2626
/license.md/i,
2727
],
2828
filterComponents: (files: string[]) =>
29-
files.filter(filepath =>
30-
/\/[A-Z]\w*(\/index)?\.(js|jsx|ts|tsx)$/.test(filepath)
31-
),
29+
files.filter(filepath => {
30+
const startsWithCapitalLetter = /\/([A-Z]\w*)\.(js|jsx|ts|tsx)$/.test(
31+
filepath
32+
)
33+
const isCalledIndex = /\/index\.(js|jsx|ts|tsx)$/.test(filepath)
34+
const hasJsxOrTsxExtension = /.(jsx|tsx)$/.test(filepath)
35+
return startsWithCapitalLetter || isCalledIndex || hasJsxOrTsxExtension
36+
}),
3237
}
3338

3439
export const getBaseConfig = (

0 commit comments

Comments
 (0)