Methods
run(cmd, optionsopt) → {Promise}
Run given command as a child process and log the call in the output.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
cmd |
string | The command to execute | |
options |
RunOptions |
<optional> |
Extra options to configure the run behaviour |
Returns:
Always returns a promise which will be resolved when the command completes
- Type
- Promise
runTask(name, …argsopt) → {Promise}
This will execute a registered task with the given name. All arguments you pass
after the name will be directly passed thru to the tasks function callback.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
name |
string | The name of the task to run | |
args |
any |
<optional> <repeatable> |
Optional arguments that will be passed to the task |
Returns:
Always returns a promise which will be resolved when the task completes
- Type
- Promise
task(name, fn, optionsopt)
Register a new task with the given name (do not use spaces in your name). If the task is
going to be called the provided callback will be executed. A task might return a `Promise`
to wait for async code to complete. Otherwise the task will be finished as soon as the
callback returns.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
name |
string | The unique task name | |
fn |
function | The task callback function (should return a Promise if async) | |
options |
TaskOptions |
<optional> |
The task options |
taskGroup(name, tasksToExecute, optionsopt)
Registers a new task (do not use spaces in your task name) that when called automatic
calls all provided task names in a sequence (`tasksToExecute` has to be a string array). If
you provide within the `tasksToExecute` array a array of strings the tasks in that sub array
are going to be executed in parallel before proceeding with the next sequence item.
The options are the same as the options for `task`.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
name |
string | The unique task name | |
tasksToExecute |
Array.<string> | The task names to be executed (they will be executed in sequence. If you provide a array instead of a string as your array element all tasks within the inner array are getting executed in parallel) | |
options |
TaskOptions |
<optional> |
The task options |
Type Definitions
AutoAnswerItem
Type:
- Object
Properties:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
search |
string | The string to search for in command output | ||
answer |
string | function | The answer to pipe to the program. Can be either a value or a function that returns a value or Promise | ||
hide |
boolean |
<optional> |
false | Hide the answer from terminal output |
RunOptions
Type:
- Object
Properties:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
cwd |
string |
<optional> |
The current working directory | |
env |
object |
<optional> |
process.env | Environment variables to be passed down to the command. The `node_modules/.bin` folder is always added to `PATH` |
stream |
boolean |
<optional> |
true | Directly print out the process output to terminal |
canFail |
boolean |
<optional> |
false | Should promise be failed if program execution failed/returned error |
autoAnswer |
Array.<AutoAnswerItem> |
<optional> |
[] | A list of auto answers to automated interactive program calls |
TaskOptions
Type:
- Object
Properties:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
description |
string |
<optional> |
Provide a description for this task for the task list output | |
hidden |
boolean |
<optional> |
false | When true hide this task from the task list output |