react-component-tree-generator
v1.0.4
Published
a small library to generate a tree of react components using markdown and markmap plugin
Downloads
95
Maintainers
Readme
React Component Tree Generator
A CLI tool to analyze a React project and generate a component tree in Markdown format for visualization with Markmap.
Features
- Automatically detects React components in a project.
- Generates a structured Markdown representation of the component hierarchy.
- Allows filtering of external library components.
- Supports scanning specific directories.
Installation
npm install -g react-component-tree-generatorUsage
react-tree [directory] [options]Arguments
directory(optional) - The root directory of your React project (default: current directory.).
Options
--ignore-libs <libs...>- Ignore components imported from specified libraries.--project-only- Only include components defined within the project.--in <dirs...>- Restrict scanning to specific directories (relative to the project root).
Example Commands
Generate a component tree for the whole project:
react-tree ./my-react-appIgnore external UI libraries:
react-tree ./my-react-app --ignore-libs react-bootstrap antdOnly scan specific directories:
react-tree ./my-react-app --in src/components src/pagesInclude only project-defined components:
react-tree ./my-react-app --project-onlyOutput Format
The script generates a Markdown file componentsTree.mm.md in the following format:
---
title: Component Tree
markmap:
colorFreezeLevel: 4
---
## Layout
- Navbar
- Home
- SlideShowA
- SlideShowB
- PersonalDetails
- CardContainerA
- Card
- CardContainerB
- CardYou can visualize this file using Markmap.
License
This project is licensed under the MIT License.
