From 29e016569a25c814997fbabef8a919c99ed22e7e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benedikt=20R=C3=B6tsch?= Date: Sat, 14 Dec 2019 10:13:02 +0100 Subject: [PATCH] feat(docz-core): allow custom pattern for globbing components with docgenConfig.searchPatterns (#1316) --- core/docz-core/src/config/argv.ts | 1 + core/docz-core/src/states/props.ts | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/core/docz-core/src/config/argv.ts b/core/docz-core/src/config/argv.ts index 13fb89282..567bde8bf 100644 --- a/core/docz-core/src/config/argv.ts +++ b/core/docz-core/src/config/argv.ts @@ -28,6 +28,7 @@ export interface DocgenConfig { resolver?: (ast: any, recast: any) => any propFilter?: (prop: any) => boolean searchPath: string + searchPatterns: string[] } export interface Menu { diff --git a/core/docz-core/src/states/props.ts b/core/docz-core/src/states/props.ts index edb6820c4..99f55e799 100644 --- a/core/docz-core/src/states/props.ts +++ b/core/docz-core/src/states/props.ts @@ -17,6 +17,10 @@ export const getPattern = (config: Config) => { docgenConfig: docgenConfig, } = config + if (docgenConfig.searchPatterns) { + return docgenConfig.searchPatterns + } + const searchPath = docgenConfig.searchPath ? docgenConfig.searchPath : source const root = paths.getRootDir(config) const srcDir = path.resolve(root, searchPath)