node-act
v1.5.0
Published
a simple task runner
Downloads
38
Maintainers
Readme
act
Simple Task Management
Quickly write, organize, and run node.js build scripts/tasks with act.
Install
$ npm install -g node-act
Setup
- Add a directory named act-tasks to the root of your project.
- For each task add a new script,
task-name.js
, to the act-tasks directory. The name of the file is the name of the task. The name must start with a lower-case letter, and the file should export a Task.
Use
$ cd <your-project-root>
# BASIC USE
$ act <task> [...-method]
# PASS VALUES
$ act <task=> <value>
$ act <task> <-method=> <value>
$ act <task=> <defaultMethodsValue> <-method=> <methodValue> <-method>
# RUN MULTIPLE TASKS
$ act <task> <task> <task>
$ act <task> <-method> <task> <task=> <value>
# SHOW HELP INFO
$ act
$ act ?
$ act -h
$ act --help
# SHOW VERSION
$ act -v
$ act --version
Tasks
All task scripts must export an object or function with the below properties.
Task with NO Methods
| Property | Type | Alias | Details | | :--------------------- | :------- | :----------- | :------------------------------------------------------------------------------------- | | description (optional) | string | desc,descrip | The description for the task. | | value (optional) | string | val | If the task accepts a value this string should be a one-word description for it. | | method | function | | The action for the task. If the task exports a function this property is not required. |
Task with Methods
| Property | Type | Alias | Details |
| :--------------------- | :--------------------------------- | :----------- | :-------------------------------------------------------------------------------------------------------- |
| description (optional) | string | desc,descrip | The description for the task. |
| value (optional) | string | val | If the task accepts a default value this string should be a one-word description for the value. |
| default | string | | The methods executed if the task is called without any arguments (e.g. "-method= value -method"
). |
| methods | object<string, Method> | | The methods for the task. |
Method
| Property | Type | Alias | Details | | :--------------------- | :------- | :----------- | :---------------------------------------------------------------------------------------------------------------------- | | description (optional) | string | desc,descrip | The description for the method. | | value (optional) | string | val | If the method accepts a value this string should be a one-word description for it. | | method | function | | The action for the method. If the Method is a function (instead of an object) this property is not required. |
Config
To change the act config just add config.json
to your act-tasks directory with your desired settings.
Shortcuts
You may create task aliases by adding an alias
property to your config.json
. The alias
property's value should be an object with name => command
pairs.
Example
{
"alias": {
"name": "task -method task= value -method"
},
"throw": false,
"exit": true,
"done": true
}
Other Details
contributing: see contributing guideline bugs/improvements: open an issue questions: [email protected]
Happy Developing