0.1.0 • Published 7 years ago

@agrarium/builder-xjst v0.1.0

Weekly downloads
-
License
MIT
Repository
github
Last release
7 years ago

Agrarium

Toolkit to collect information about components with microplugin infrastructure.

Usage

npm i agrarium

CLI

Put .agrarium.js config to the root of your project.

const { presetDefault, PluginDTS } = require('agrarium');

module.exports = {
    src: ['./src/components'],
    plugins: [
        presetDefault({/* options */}),
        new PluginDTS({/* options */})
    ]
};

Read more info about config here.

Run in terminal:

$ agrarium harvest --json -o data.json

Read more about CLI commands here.

Node API

const { agrarium, presetDefault, PluginDTS } = require('agrarium');

agrarium({
    src: ['./src/components'],
    plugins: [
        presetDefault({/* options */}),
        new PluginDTS({/* options */})
    ]
}); // -> Readable Stream

Read more about NodeJS usage here.

Plugins

Not enough? Build your own plugin!

Presets

Examples

Build your own plugin

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.

License MIT