react-docgen
react-docgen copied to clipboard
react-docgen generates platform specific structure
react-docgen --pretty -o lib/metadata.json src/components
On Windows produces:
{
"src\\components\\ExampleComponent.react.js": {
"description": "ExampleComponent is an example component.\r\nIt takes a single property, `label`, and\r\ndisplays it.",
"methods": [],
"props": {
"label": {
"type": {
"name": "string"
},
"required": true,
"description": "A label that will be printed when this component is rendered."
}
}
}
}
On Linux produces:
{
"src/components/ExampleComponent.react.js": {
"description": "ExampleComponent is an example component.\r\nIt takes a single property, `label`, and\r\ndisplays it.",
"methods": [],
"props": {
"label": {
"type": {
"name": "string"
},
"required": true,
"description": "A label that will be printed when this component is rendered."
}
}
}
}
This makes some scripts which use results of react-docgen for code generation fail. One example is plotly/dash component generator. Would you consider this is as a bug?
Hi,
May I ask you @chaliy how you got react-docgen --pretty -o lib/metadata.json src/components working on Windows? I get "unknown command'
I also tried npm run react-docgen --pretty -o lib/metadata.json src/components without luck (missing component).
@j2l , do you have it installed globally? Something like npm install react-docgen -g?
Would you consider this is as a bug?
Good question, idk. Consistency in the output is certainly important. However would it feel strange if the path was using / on Windows?
I'm not using Windows, so I can't tell if someone would be bothered by this. Ideally, people who use Windows good provide their point of view here.
@chaliy you are right, I didn't, thanks for pointing it out. My bad.
It is not a bug per say but this inconsistency is annoying. When developing alternatively on windows and on mac OS, which is my case, you will have some issue exploiting the generated path.
To go further on this, the linux/macOS way of labeling the paths works on most windows shells mypath/tatata/coco.js
but not the other way around.
So yeah it would be nice to have always the same method, the linux way.