Share your code. npm Orgs help your team discover, share, and reuse code. Create a free org »


1.0.0 • Public • Published


npm install elasticio-cli -g

In order to check if the installation was successful, just type in your terminal:

$ elasticio

You should see an output like this:

$ elasticio tools 0.0.5
  cmp:process <options>
  cmp:exec <options>
  oauth2 <options>

Executing component's process function

Executing a component on your local machine is accomplished by elasticio cmp:exec command. If you execute that command you should see following output:

elasticio cmp:process
  Usage: elasticio [options] [undefined]
    -h, --help            output usage information
    -p, --path <path>     Path to the component file to be executed. Absolute or relative.
    -f, --function [key]  Function name to be executed
    -x, --fixture [key]   Key of the fixture providing configuration for the execution

The most important parameter is -p which tells the command where to finde the component's node.js module. This files is expeted to export the process function to be executed.

The process(msg, cfg) function takes at least 2 parameters:

  • msg: the message to be process by the component
  • cfg: component's configuration

In order to execute your component, we need to know what parameters to pass to its process function. This is what the fixtures are for.

Fixtures are defined in a file test/fixture.json whereby the test folder is is expected to be located next to component.json file. Here is an example of a fixture.json file. called fixtures.


The content of the file is a JSON object with a single key fixtures which contains named fixtures. Each fixture defines arguments to be passed to component's process function: a message and configuration objects.

The only fixture in example above is named success. Please note that the component's configuration may contain sensible data, such as API keys or OAuth tokens. Such data must not be placed inside fixture files because you will push them to your version control system, such as GitHub. Instead they should be replaced by variables using the Handlebars syntax:


The variable values can be store in a file named elastic.json which is located from your user's home directory. For example on my Mac the file is located at /Users/igor/elastic.json. This file is again a JSON file containing all the secret values. Soon we will support encryption.


Now that you have a fixture prepared, you can execute your component as shown below.

  elasticio cmp:process -p lib/hello_world/hello.js -x success

The command takes 2 arguments:

  • -p: path to the component's file exporting the process function
  • -x: fixture name to be used for component execution




npm i elasticio-cli

Downloadsweekly downloads






last publish


  • avatar
  • avatar