https://github.com/agrarium/agrarium
Tool for transform information with JS plugins.
https://github.com/agrarium/agrarium
collector components data-structures docs documentation generic jsdoc streams typescript
Last synced: 7 months ago
JSON representation
Tool for transform information with JS plugins.
- Host: GitHub
- URL: https://github.com/agrarium/agrarium
- Owner: agrarium
- Created: 2017-11-07T07:50:51.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2019-02-12T15:32:55.000Z (over 6 years ago)
- Last Synced: 2025-04-10T21:16:09.028Z (7 months ago)
- Topics: collector, components, data-structures, docs, documentation, generic, jsdoc, streams, typescript
- Language: TypeScript
- Homepage:
- Size: 154 KB
- Stars: 5
- Watchers: 4
- Forks: 4
- Open Issues: 9
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Agrarium
Toolkit to collect information about components with microplugin infrastructure.
## Usage
```sh
npm i agrarium
```
### CLI
Put `.agrarium.js` config to the root of your project.
``` js
const { presetDefault, PluginDTS } = require('agrarium');
module.exports = {
src: ['./src/components'],
plugins: [
presetDefault({/* options */}),
new PluginDTS({/* options */})
]
};
```
Read more info about config [here](packages/cli#agrarium-config).
Run in terminal:
```sh-session
$ agrarium harvest --json -o data.json
```
Read more about CLI commands [here](packages/cli#harvest).
### Node API
```js
const { agrarium, presetDefault, PluginDTS } = require('agrarium');
agrarium({
src: ['./src/components'],
plugins: [
presetDefault({/* options */}),
new PluginDTS({/* options */})
]
}); // -> Readable Stream
```
Read more about NodeJS usage [here](packages/core).
## Plugins
- [Markdown](packages/plugin-markdown)
- [List](packages/plugin-list)
- [BemJSD](packages/plugin-bemjsd)
- [Types Definitions](packages/plugin-dts)
Not enough? [Build your own plugin!](#build-your-own-plugin)
## Presets
- [Default](packages/preset-default)
## Examples
- [React components](https://github.com/agrarium/example-bem-react)
- [BEM components](https://github.com/agrarium/example-bem-origin)
- [Gulp builder](https://github.com/agrarium/example-bem-builder-origin)
## Build your own plugin
```js
const { Plugin } = require('agrarium');
class AwesomePlugin extends Plugin {
async gather({ key, files }) {
return { filesQty: files.length };
}
}
agrarium({
src: ['./src/components' ],
plugins: [
new AwesomePlugin()
]
}).on('data', ({ key, files, data }) => {
console.log(data); // { filesQty }
}).resume();
```
Read more about plugins API [here](packages/plugin).
## License MIT