react-monocle

A developer tool to visualize a React application's component hierarchy.

Github stars Tracking Chart

react-monocle

Build Status npm version

How It Works

React Monocle parses through your React source files to generate a visual tree graph representing your React component hierarchy.
The tree is then displayed along with a live copy of your application.
This is done by using your un-minified bundle file to inject wrapper functions around setState calls in order to have our tree display real-time feedback.
The rendered tree is synced up to the state(s) of your component using Redux, and as the state of your live app changes, the monocle tree graph will also provide visual feedback of data flow and state changes through the React components.

Setup

IMPORTANT The way we use your bundle file requires so that the bundle is not mangled (ie not minified).

  1. npm install -g react-monocle
  2. Navigate to the directory which contains your html file.
  3. Type in monocle -h in order to find what options suit your needs the best. The only required option is specifying the bundle.

Options, Option, Command, Description, -------------, -------------------, ------------------------------------------------------------------------------------------------------------------------------, Bundle, --bundle (-b), Required Path to React bundle file., HTML, --html (-c), HTML page which has your bundle and CSS files. Specify if you want CSS displayed and/or you are relying on external scripts., Entry, --entry (-e), App entry point. Defaults to JSX file where ReactDOM.render is found., Directory, --directory (-d), directory of React files. Defaults to where Monocle was called., ## Contributing/Testing

  • Please feel free to fork and submit pull requests!
  • After installing, you can run tests via npm run unit-tests or npm run test to run ESLint simultaneously
  • Tests can be found in src/test and are currently broken out into:
    1. astGeneratorTest.js
    2. d3DataBuilderTest.js
    3. iterTest.js
    4. previewParserTest.js
    5. reactParserTest.js
    6. test.js (to compile and run all tests at once)
  • Please add new tests to relevant files specified above, or create new test files as needed.

Coming Soon

  • Demo
  • Quick description of what goes on under the hood.
  • Improving how we search for components

In the Pipeline

  • Support for React-Router
  • Support for Redux

Our Team

License

MIT

Main metrics

Overview
Name With Ownerteam-gryff/react-monocle
Primary LanguageJavaScript
Program languageJavaScript (Language Count: 2)
Platform
License:MIT License
所有者活动
Created At2016-06-25 00:19:36
Pushed At2017-05-09 00:34:51
Last Commit At2017-05-08 17:34:50
Release Count0
用户参与
Stargazers Count2.4k
Watchers Count42
Fork Count77
Commits Count447
Has Issues Enabled
Issues Count27
Issue Open Count18
Pull Requests Count123
Pull Requests Open Count0
Pull Requests Close Count1
项目设置
Has Wiki Enabled
Is Archived
Is Fork
Is Locked
Is Mirror
Is Private