Socket
Socket
Sign inDemoInstall

@agrarium/cli

Package Overview
Dependencies
118
Maintainers
3
Versions
2
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @agrarium/cli

Agrarium CLI Toolbox


Version published
Weekly downloads
4
increased by100%
Maintainers
3
Install size
4.36 MB
Created
Weekly downloads
 

Readme

Source

Agrarium CLI

Simple CLI tool for collecting data in terminal.

Usage

$ npm install -g @agrarium/cli
$ agrarium COMMAND
$ agrarium (-v|--version|version)
$ agrarium --help [COMMAND]

Commands

  • agrarium harvest
  • agrarium help [COMMAND]

harvest

Collect all data for components.

USAGE
  $ agrarium harvest

OPTIONS
  -c, --config=p/t/config       Path to Agrarium config
  -d, --workdir=my/cwd          Working directory
  -j, --json                    Export data as JSON
  -o, --output=file.json        Path to output file with harvested data
  -s, --silent                  No info to stdout
  --concurently=/lib/worker.js  Path to chunk worker
  --flush=/lib/prepareData.js   Path to result transformer

EXAMPLE

  ❯ agrarium harvest
  ❯ agrarium harvest -o output.txt
  ❯ agrarium harvest -j -o path/to/harvest.json
  ❯ agrarium harvest --concurenty path/to/worker.js
  ❯ agrarium harvest --flush path/to/worker.js
  ❯ agrarium harvest -c ../.agrarium.js -c path/to/one/more/.agrarium.js
  ❯ agrarium harvest -j | xargs echo > ./file.json
  ❯ agrarium harvest | builder

help

Display help for agrarium command.

USAGE
  $ agrarium help [COMMAND]

ARGUMENTS
  COMMAND  command to show help for

OPTIONS
  --all  see all commands in CLI

Configure

Agrarium config

By default Agrarium uses .agrarium.js from your working directory.

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

module.exports = {
    src: ['./components'],
    plugins: [
        presetDefault({/* options */}),
        new PluginDTS({/* options */})
    ],
    transform: /* optional */ function(chunk) {
        // Customiize your data by chunk
        return chunk;
    }
};

It can be an array of configs.

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

const plugins = [
    presetDefault({/* options */}),
    new PluginDTS({/* options */})
];

module.exports = [{
    src: ['./components'],
    plugins
}, {
    src: ['./lib/components'],
    plugins,
    transform: function({ data, context }) {
        return {
            markdown: data.markdown,
            components: context.components,
            dts: data.dts,
            say: 'Hello Agrarium!'
        };
    }
}];

Worker

It any module wich you can use to build|compile|whatever for every chunk.

module.exports = function worker(chunk) {
    setTimeout(() => {
        console.log(chunk.component.key);
    }, 0);
}

Flush

It any module wich you can use transform result data before output.

module.exports = function flush(data) {
    data.push('hi hi ;)');
    return data;
}

License MIT

FAQs

Last updated on 24 May 2018

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc