kebot

0.1.5 • Public • Published

npm version Build Status Coverage Status

What is kebot?

Kebot is a tool that will help you manage your development scripts as well as locally installed CLI.

Documentation

For an introduction to our API and more read our wiki!

kebot API

kebot.task(options)

var kebot = require("kebot");
 
kebot.task({
  alias:"script",
  entry:"./task/script.js"
});

options

Type: Object

options.alias

Type: String

alias Name of the task to use by the CLI.

options.entry

Type: String

alias The path of your node script.

options.command

Type: String

command Run any installed CLI

options.sequential

Type: Array

sequential When you have option.entry task dependencies, are executed sequentially and at the end the main task is executed.

When you not have option.entry they are only tasks that are executed sequentially.

options.parallel

Type: Array

parallel Tasks that run in sequence without dependency.

options.local

type: Boolean local In true : Run a CLI from a locally installed package, just like npm scripts when to use command input. Default false

Use cases

  • Run any installed CLI, using the command property.
var kebot = require("kebot");
 
kebot.task({
  alias: "list",
  command: "ls -l"
});
kb list
  • Run any globally installed CLI with npm, using the command property.
var kebot = require("kebot");
 
kebot.task({
  alias: "build",
  command: "babel -w ./source/ -d ./lib/"
});

If you have it installed locally in your project use local in true, like npm scripts, using the command property.

var kebot = require("kebot");
 
kebot.task({
  alias: "build",
  command: "babel -w ./source/ -d ./lib/",
  local: true
});
kb build
  • Run a file script.js, using the entry
var kebot = require("kebot");
 
kebot.task({
  alias: "task",
  entry: "./task/script.js"
});
kb task
  • To run a script.js file with dependent tasks, using the sequential property.
var kebot = require("kebot");
 
kebot.task({
  alias: "css",
  entry: "./task/css.js",
  sequential: ["fonts", "svg"]
});
 
kebot.task({
  alias: "css",
  entry: "./task/fonts.js"
});
 
kebot.task({
  alias: "css",
  entry: "./task/svg.js"
});

Use the -a flag to execute dependencies. The order of execution is.

  • fonts
  • svg
  • css
kb css -a
  • Execute any command or entry in parallel, using the parallel property.
var kebot = require("kebot");
 
kebot.task({
  alias: "watch",
  entry: "./task/watch.js"
});
 
kebot.task({
  alias: "css",
  entry: "./task/css.js"
});
 
kebot.task({
  alias: "all",
  parallel: ["watch", "css"]
});
kb all
  • Run a task with an environment, use the flag --env
var kebot = require("kebot");
 
kebot.task({
  alias: "css",
  entry: "./task/css.js"
});

Accept multiples arguments

  • arguments passed by cli are received through process.env

command:

  kb mytask --param 1 --paramtwo valuetwo

kebotfile:

var kebot = require("kebot");
 
kebot.task({
  alias: "css",
  entry: "./task/args.js"
});

task args.js:

console.log('my task args');
console.log(process.env.param); // = 1
console.log(process.env.paramtwo) // = valuetwo

Use it in your script with process.env.production which is equal to true

kb css --env production

Readme

Keywords

none

Package Sidebar

Install

npm i kebot

Weekly Downloads

1

Version

0.1.5

License

MIT

Last publish

Collaborators

  • wilsson