Skip to content

Commit

Permalink
fix: correct props loading (#836)
Browse files Browse the repository at this point in the history
  • Loading branch information
ejuo authored and pedronauck committed Apr 30, 2019
1 parent 80b186c commit ed85f14
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion core/docz-core/src/utils/docgen/javascript.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import * as fs from 'fs-extra'
import * as path from 'path'
import logger from 'signale'
import externalProptypesHandler from 'react-docgen-external-proptypes-handler'
import actualNameHandler from 'react-docgen-actual-name-handler'
Expand All @@ -25,7 +26,7 @@ export const jsParser = (files: string[], config: Config) => {
try {
const code = fs.readFileSync(filepath, 'utf-8')
const props = reactDocgen.parse(code, resolver, handlers)
return { key: filepath, value: props }
return { key: path.normalize(filepath), value: props }
} catch (err) {
if (config.debug) throwError(err)
return null
Expand Down
2 changes: 1 addition & 1 deletion core/docz-core/src/utils/docgen/typescript.ts
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ const parseFiles = (files: string[], config: Config, tsconfig: string) => {
}

return files.map(filepath => ({
key: filepath,
key: path.normalize(filepath),
value: parser.parseWithProgramProvider(filepath, programProvider),
}))
}
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 @@ -108,7 +108,7 @@ export const Props: SFC<PropsProps> = ({
const { props: stateProps } = React.useContext(doczState.context)
const PropsComponent = components.props
const filename = get('__filemeta.filename', component)
const componentName = component.displayName || component.name
const componentName = get('__filemeta.name', component) || component.displayName || component.name
const found =
stateProps &&
stateProps.length > 0 &&
Expand Down

0 comments on commit ed85f14

Please sign in to comment.