Command Line Interface (CLI) Reference

This is the complete reference of all available options for the CLI. A basic getting started guide can be found on this page.






Default: false

Normally the CLI will not fail the process when warnings occur in react-docgen and instead, print them to stderr. When this option is specified the CLI will exit with status code 2 on react-docgen warnings. This currently includes the following warnings:

  • ERR_REACTDOCGEN_MISSING_DEFINITION: No suitable component definition found.
  • ERR_REACTDOCGEN_MULTIPLE_DEFINITIONS: Multiple exported component definitions found. (This can only happen when using the findExportedComponentDefinition resolver)

Any other errors will always make the process exit with status code 1, independent of this option.

--handler <handlers>

Default: find the current default handlers on GitHub ↗ (opens in a new tab)



Displays the help for the command with the current default values.

-i, --ignore <globs>

Default: ["**/node_modules/**", "**/__tests__/**", "**/__mocks__/**"]


--importer <importer>



Default: false

Enabling this option will disable any of the default ignores specified in the ignore option.

-o, --out <file>

Store extracted information in the specified file instead of printing to stdout. If the file exists it will be overwritten.




Default: false

This option will make the CLI print the output JSON with proper spacing and newlines.

--resolver <resolvers>

Default: ["find-exported-component", "find-annotated-components"]

Allows to specify the resolvers that find react components in the code.

Possible values are:

Built-in resolvers

  • find-all-components
  • find-all-exported-components
  • find-all-annotated-components
  • find-exported-component

Path to resolver

A path can be specified to your resolver. The path can be absolute (recommended) or relative and in the later case the path will be resolved from the current working directory.

Module name of resolver

An npm module name can be specified. The default export of this module needs to be an instance of the resolver.