SourceJS auto React dependencies builder middleware.
npm install sourcejs-react-dependenciesUses : babylon: "~5.8.3", recast: "^0.10.41" & node-source-walk: "^2.1.0" to renders React components dependencies into SourceJS Spec page.
Compatible with SourceJS 0.6.0+.
```
npm install sourcejs-react-dependencies --save
After restarting your app, middleware will be loaded automatically. To disable it, remove npm module and restart the app.
After installing the middleware, during SourceJS Spec load plugin will try to find first file, analyze it and expose raw and rendered into HTML data objects. Data will be then available within EJS Spec pre-rendering.
Insert these code snippets anywhere you want in your Spec file:
`htmlMy Spec
Default Example
<%- info.__dependenciesRAW.description[0].name %>
<%- info.__dependenciesHTML %>
# My Spec
## Default Example
<%- info.__dependenciesRAW.description[0].name %>
<%- info.__dependenciesHTML %>
`example
code
`Check usage examples in sourcejs-react-bundle-example
$3
* info.__dependenciesRAW - raw JSON array with objects
* info.__dependenciesGROUPED - raw JSON object with arrays
* info.__dependenciesHTML - rendered list
Configuration
Or overriding global plugin configuration:
`javascript
module.exports = {
plugins: {
dependencies: {
componentPath: 'custom/path/index.jsx',
}
}
};
`See other configuration options below.
$3
Default: true
Type: _boolean_
Set
false` to disable middleware.Default: '*.jsx'
Type: _string_
Define custom path to component entry file. Accepts glob string, which will be resolved relatively to spec path (takes only first found file).
* Better styling
* Detecting if a dependency is a spec and thus has a page to link to
* Link to npm package
Pull request highly welcome!