Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(docz): correct props loading #836

Merged
merged 1 commit into from
Apr 30, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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