# inspectr

> Inspect React components from the command line

Latest version **0.0.6** (published 2016-02-18) · MIT license · 0 weekly downloads

## Install

```sh
npm install inspectr
pnpm add inspectr
yarn add inspectr
bun add inspectr
```

Provides the command `inspectr`.

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.6 |
| Published | 2016-02-18 |
| First published | 2016-02-18 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 18 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 2 |
| Author | Charles King |
| Maintainers | bringking |
| Keywords | react, command, cli, propTypes, inspection |

## Links

- npm: https://www.npmjs.com/package/inspectr
- Repository: https://github.com/RinconStrategies/inspectr
- Homepage: https://github.com/RinconStrategies/inspectr#readme
- Issues: https://github.com/RinconStrategies/inspectr/issues
- npm.io page: https://npm.io/package/inspectr

## Dependencies (18)

- [react](https://npm.io/package/react.md) ^0.14.7
- [recast](https://npm.io/package/recast.md) ^0.11.0
- [cli-table](https://npm.io/package/cli-table.md) ^0.3.1
- [commander](https://npm.io/package/commander.md) ^2.9.0
- [find-root](https://npm.io/package/find-root.md) ^0.1.1
- [array-find](https://npm.io/package/array-find.md) ^1.0.0
- [babel-core](https://npm.io/package/babel-core.md) ^6.5.2
- [react-docgen](https://npm.io/package/react-docgen.md) ^2.7.0
- [babel-register](https://npm.io/package/babel-register.md) ^6.5.2
- [lodash.isobject](https://npm.io/package/lodash.isobject.md) ^3.0.2
- [lodash.isfunction](https://npm.io/package/lodash.isfunction.md) ^3.0.8
- [babel-preset-react](https://npm.io/package/babel-preset-react.md) ^6.5.0
- [babel-preset-es2015](https://npm.io/package/babel-preset-es2015.md) ^6.5.0
- [babel-preset-stage-0](https://npm.io/package/babel-preset-stage-0.md) ^6.5.0
- [react-addons-test-utils](https://npm.io/package/react-addons-test-utils.md) ^0.14.7
- [babel-helper-builder-react-jsx](https://npm.io/package/babel-helper-builder-react-jsx.md) ^6.5.0
- [babel-plugin-transform-decorators](https://npm.io/package/babel-plugin-transform-decorators.md) ^6.5.0
- [babel-plugin-transform-class-properties](https://npm.io/package/babel-plugin-transform-class-properties.md) ^6.5.2

## Alternatives

- [@salesforce/cli](https://npm.io/package/@salesforce/cli.md) — 389.7K weekly downloads
- [@mintlify/cli](https://npm.io/package/@mintlify/cli.md) — 208.9K weekly downloads
- [@grafana/e2e-selectors](https://npm.io/package/@grafana/e2e-selectors.md) — 128.7K weekly downloads
- [mintlify](https://npm.io/package/mintlify.md) — 112.0K weekly downloads
- [@intlayer/cli](https://npm.io/package/@intlayer/cli.md) — 22.8K weekly downloads

## Recent versions

- 0.0.6 (latest) — 2016-02-18
- 0.0.5 — 2016-02-18
- 0.0.4 — 2016-02-18
- 0.0.3 — 2016-02-18
- 0.0.2 — 2016-02-18
- 0.0.1 — 2016-02-18

## README

# inspectr
A CLI for inspecting React components to reveal propTypes and defaultProps values.

##Installation
```bash
npm install -g inspectr
```
##Usage
inspectr takes two arguments 
```bash
inspectr <module> [component] 
```
inspectr takes the -f option to specify a specific file path to inspect
```bash
inspectr <module-path> [component] -f 
```
###module
The `module` argument is the name of the module to search for a React Component to inspect or if you pass `-f` the relative file path to a module to inspect. 

###component
The `component` argument is optional if you are inspecting default exports, however to inspect named exports, you need to pass the name of the export here. 

##Examples
###Inspecting node modules
Assuming you want to inspect react-router and are in your project root, run -
```bash
inspectr react-router

┌──────────────────┬────────────────────────┬────────────────────────────────────────────┐
│ Property         │ Type                   │ Default Value                              │
├──────────────────┼────────────────────────┼────────────────────────────────────────────┤
│ history          │ React.PropTypes.object │ N/A                                        │
├──────────────────┼────────────────────────┼────────────────────────────────────────────┤
│ children         │ React.PropTypes.object │ N/A                                        │
├──────────────────┼────────────────────────┼────────────────────────────────────────────┤
│ routes           │ React.PropTypes.object │ N/A                                        │
├──────────────────┼────────────────────────┼────────────────────────────────────────────┤
│ RoutingContext   │ React.PropTypes.func   │ function RoutingContext() {                │
│                  │                        │     _classCallCheck(this, RoutingContext); │
│                  │                        │                                            │
│                  │                        │     _Component.apply(this, arguments);     │
│                  │                        │   }                                        │
├──────────────────┼────────────────────────┼────────────────────────────────────────────┤
│ createElement    │ React.PropTypes.func   │ N/A                                        │
├──────────────────┼────────────────────────┼────────────────────────────────────────────┤
│ onError          │ React.PropTypes.func   │ N/A                                        │
├──────────────────┼────────────────────────┼────────────────────────────────────────────┤
│ onUpdate         │ React.PropTypes.func   │ N/A                                        │
├──────────────────┼────────────────────────┼────────────────────────────────────────────┤
│ parseQueryString │ React.PropTypes.func   │ N/A                                        │
├──────────────────┼────────────────────────┼────────────────────────────────────────────┤
│ stringifyQuery   │ React.PropTypes.func   │ N/A                                        │
└──────────────────┴────────────────────────┴────────────────────────────────────────────┘
```
If you want to inspect the `Link` component, you could run
```bash
inspectr react-router Link

┌───────────────────┬────────────────────────┬───────────────┐
│ Property          │ Type                   │ Default Value │
├───────────────────┼────────────────────────┼───────────────┤
│ to                │ React.PropTypes.string │ N/A           │
├───────────────────┼────────────────────────┼───────────────┤
│ query             │ React.PropTypes.object │ N/A           │
├───────────────────┼────────────────────────┼───────────────┤
│ hash              │ React.PropTypes.string │ N/A           │
├───────────────────┼────────────────────────┼───────────────┤
│ state             │ React.PropTypes.object │ N/A           │
├───────────────────┼────────────────────────┼───────────────┤
│ activeStyle       │ React.PropTypes.object │ N/A           │
├───────────────────┼────────────────────────┼───────────────┤
│ activeClassName   │ React.PropTypes.string │ N/A           │
├───────────────────┼────────────────────────┼───────────────┤
│ onlyActiveOnIndex │ React.PropTypes.bool   │ N/A           │
├───────────────────┼────────────────────────┼───────────────┤
│ onClick           │ React.PropTypes.func   │ N/A           │
└───────────────────┴────────────────────────┴───────────────┘

```
###Inspecting file paths
To inspect your own components you can use file paths with the `-f` option.

```bash
inspectr app/javascripts/components/button.jsx -f
```

##Limitations
Currently inspectr can only determine PropTypes through evaluting the `checkType` returned from the React PropTypes definition. So this means it supports the following propTypes-
* React.PropTypes.array
* React.PropTypes.bool
* React.PropTypes.func
* React.PropTypes.number
* React.PropTypes.object
* React.PropTypes.string
* React.PropTypes.any

---
_Source: https://npm.io/package/inspectr · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
