Skip to content

Commit

Permalink
feat(docz-core): extended path configuration for docgen (#846)
Browse files Browse the repository at this point in the history
  • Loading branch information
ejuo authored and pedronauck committed May 1, 2019
1 parent 9a3b12b commit aa96739
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
3 changes: 2 additions & 1 deletion core/docz-core/src/config/argv.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ export type ThemeConfig = Record<string, any>
export interface DocgenConfig {
handlers?: any[]
resolver?: (ast: any, recast: any) => any
propFilter?: (prop: any) => boolean
propFilter?: (prop: any) => boolean,
searchPath: string
}

export interface Menu {
Expand Down
4 changes: 2 additions & 2 deletions core/docz-core/src/states/props.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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([
Expand Down
2 changes: 1 addition & 1 deletion core/docz/src/components/Props.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ export const Props: SFC<PropsProps> = ({
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)
Expand Down

0 comments on commit aa96739

Please sign in to comment.