diff --git a/core/docz-core/src/config/argv.ts b/core/docz-core/src/config/argv.ts index c92dba078..5603de158 100644 --- a/core/docz-core/src/config/argv.ts +++ b/core/docz-core/src/config/argv.ts @@ -26,7 +26,8 @@ export type ThemeConfig = Record export interface DocgenConfig { handlers?: any[] resolver?: (ast: any, recast: any) => any - propFilter?: (prop: any) => boolean + propFilter?: (prop: any) => boolean, + searchPath: string } export interface Menu { diff --git a/core/docz-core/src/states/props.ts b/core/docz-core/src/states/props.ts index 5bbac6dea..2693ec6bc 100644 --- a/core/docz-core/src/states/props.ts +++ b/core/docz-core/src/states/props.ts @@ -9,8 +9,8 @@ import { Config } from '../config/argv' import { docgen } from '../utils/docgen' const getPattern = (config: Config) => { - const { typescript: ts, ignore, src: source } = config - const src = relative(paths.root, source) + const { typescript: ts, ignore, src: source, docgenConfig: docgenConfig } = config + const src = relative(paths.root, docgenConfig.searchPath ? docgenConfig.searchPath : source) return ignore .map(entry => `!**/${entry}`) .concat([ diff --git a/core/docz/src/components/Props.tsx b/core/docz/src/components/Props.tsx index 236aeb9d3..28907e2b7 100644 --- a/core/docz/src/components/Props.tsx +++ b/core/docz/src/components/Props.tsx @@ -112,7 +112,7 @@ export const Props: SFC = ({ const found = stateProps && stateProps.length > 0 && - stateProps.find(item => item.key === filename) + stateProps.find(item => filename ? item.key === filename : item.key.includes(`${componentName}.`)) const value = get('value', found) || [] const firstDefinition = first(value)