reactjs / reactjs/react-docgen

react-docgen generates platform specific structure

Open
#199 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

needs-discussion
Dominant language
TypeScript
Stars
3.8k
Forks
316
Avg merge
5h 7m
Merged PRs (30d)
4

Description

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?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the react-docgen CLI invocation using src/components and lib/metadata.json, then trace where component paths are serialized. Compare the Windows and Linux examples and make the generated keys platform-independent; verify that both environments produce the same structure.

Written by the indexing model from the issue text.

Assessment

Tech stack
react
Domain
cli
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.