-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: initial props-info packages integration
- Loading branch information
1 parent
0e69643
commit cb2ee07
Showing
13 changed files
with
108 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,29 @@ | ||
import { PropTypes } from '@component-controls/specification'; | ||
import { ComponentInfo } from '@component-controls/specification'; | ||
import { | ||
extractDocgenTypescriptInfo, | ||
RectDocgenTypescriptOptions, | ||
} from './react-docgen-typescript'; | ||
import { transformProps } from './transform-props'; | ||
|
||
export default (options?: RectDocgenTypescriptOptions) => { | ||
return (fileName: string, componentName?: string): PropTypes | undefined => { | ||
return async ( | ||
fileName: string, | ||
componentName?: string, | ||
): Promise<ComponentInfo | undefined> => { | ||
const propTable = extractDocgenTypescriptInfo( | ||
fileName, | ||
componentName, | ||
options, | ||
); | ||
return { | ||
...propTable, | ||
props: transformProps(propTable.props), | ||
}; | ||
return new Promise(resolve => | ||
resolve( | ||
propTable | ||
? { | ||
...propTable, | ||
props: transformProps(propTable.props), | ||
} | ||
: undefined, | ||
), | ||
); | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,24 @@ | ||
import { PropTypes } from '@component-controls/specification'; | ||
import { ComponentInfo } from '@component-controls/specification'; | ||
|
||
import { extractDocgenInfo, RectDocgenOptions } from './react-docgen'; | ||
import { transformProps } from './transform-props'; | ||
|
||
export default (options?: RectDocgenOptions) => { | ||
return ( | ||
return async ( | ||
fileName: string, | ||
componentName?: string, | ||
source?: string, | ||
): PropTypes | undefined => { | ||
): Promise<ComponentInfo | undefined> => { | ||
const propTable = extractDocgenInfo(fileName, source, options); | ||
return { | ||
...propTable, | ||
props: transformProps(propTable.props), | ||
}; | ||
return new Promise(resolve => | ||
resolve( | ||
propTable | ||
? { | ||
...propTable, | ||
props: transformProps(propTable.props), | ||
} | ||
: undefined, | ||
), | ||
); | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters