Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/wilsson/kebot
Node scripts and command automaton
https://github.com/wilsson/kebot
automation cli tasks tool
Last synced: about 1 month ago
JSON representation
Node scripts and command automaton
- Host: GitHub
- URL: https://github.com/wilsson/kebot
- Owner: wilsson
- License: mit
- Created: 2017-02-02T22:33:42.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2023-01-12T05:35:40.000Z (almost 2 years ago)
- Last Synced: 2024-09-18T05:28:23.809Z (2 months ago)
- Topics: automation, cli, tasks, tool
- Language: JavaScript
- Homepage:
- Size: 621 KB
- Stars: 11
- Watchers: 4
- Forks: 2
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[![npm version](https://badge.fury.io/js/kebot.svg)](https://badge.fury.io/js/kebot)
[![Build Status](https://travis-ci.org/wilsson/kebot.svg?branch=master)](https://travis-ci.org/wilsson/kebot)
[![Coverage Status](https://coveralls.io/repos/github/wilsson/kebot/badge.svg?branch=master)](https://coveralls.io/github/wilsson/kebot?branch=master)## 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](https://github.com/wilsson/kebot/wiki)!
### kebot API
#### kebot.task(options)
```js
var kebot = require("kebot");kebot.task({
alias:"script",
entry:"./task/script.js"
});
```
#### optionsType: `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.
```js
var kebot = require("kebot");kebot.task({
alias: "list",
command: "ls -l"
});
``````bash
kb list
```- Run any globally installed CLI with npm, using the `command` property.
```js
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.
```js
var kebot = require("kebot");kebot.task({
alias: "build",
command: "babel -w ./source/ -d ./lib/",
local: true
});
``````bash
kb build
```- Run a file `script.js`, using the `entry`
```js
var kebot = require("kebot");kebot.task({
alias: "task",
entry: "./task/script.js"
});
``````bash
kb task
```- To run a `script.js` file with dependent tasks, using the `sequential` property.
```js
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```bash
kb css -a
```- Execute any `command` or `entry` in parallel, using the `parallel` property.
```js
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"]
});
``````bash
kb all
```- Run a task with an environment, use the flag `--env`
```js
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:
```bash
kb mytask --param 1 --paramtwo valuetwo
```kebotfile:
```js
var kebot = require("kebot");kebot.task({
alias: "css",
entry: "./task/args.js"
});
```task args.js:
```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`
```bash
kb css --env production
```