0.0.0-alpha.0 • Published 4 years ago
propspotter v0.0.0-alpha.0
Propspotter
Propspotter runs through your app's JSX and allows you to explore how your React components are being used. Propspotter provides a standalone environment that can be used or deployed with your design system documentation.
Demos
Getting Started
Install propspotter
in your app:
npm i propspotter@alpha
Create a propspotter config file named propspotter.config.js
in the root directory of your app:
// propspotter.config.js
module.exports = {
// Sets page title
title: 'My App',
// Glob pattern for your app's code
// Indicates where component data will be sourced
include: '/src/**/!(*.spec|*.test).js',
// Specifies which port Propspotter should use
// Defaults to 9000
port: 9000,
// If provided, prepends this url to component locations and turns them into links
locationUrl: 'https://github.com/jonambas/propspotter/tree/master/example',
// If true, opens webpack dev server in a new tab when running the start command
// Defaults to true
openBrowser: true,
// Specifies where to output the webpack build
// Defaults to "dist/propspotter"
outputPath: 'dist/propspotter'
};
Add the following scripts to your npm package.json
.
// package.json
"scripts": {
"propspotter:start": "propspotter start",
"propspotter:build": "propspotter build"
}
And finally, run propspotter
npm run propspotter:start
Limitations
Propspotter uses typescript's compiler API to parse through your JSX.
- Components will only be detected when explicitly rendered with JSX, ie
<MyComponent />
. - Components may not accurately represent their
displayName
if they are aliased or renamed. - Prop values that contain expressions such as variables or functions are not evaluated, but are stringified and truncated. Eg, if you use css-modules, you can filter
className
to includestyles.css-class
.
License
MIT
0.0.0-alpha.14
4 years ago
0.0.0-alpha.13
4 years ago
0.0.0-alpha.12
4 years ago
0.0.0-alpha.11
4 years ago
0.0.0-alpha.10
4 years ago
0.0.0-alpha.9
4 years ago
0.0.0-alpha.8
4 years ago
0.0.0-alpha.7
4 years ago
0.0.0-alpha.6
4 years ago
0.0.0-alpha.3
4 years ago
0.0.0-alpha.4
4 years ago
0.0.0-alpha.2
4 years ago
0.0.0-alpha.5
4 years ago
0.0.0-alpha.0
4 years ago