Defines all the logic for the cfgi runner.
- Source:
Requires
Methods
(static) command(cmd, silentopt) → {RunOutput}
Executes a command synchronously using the specified command string.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
cmd |
string | The command string to be executed. | ||
silent |
boolean |
<optional> |
true | Whether to suppress output. |
- Source:
Returns:
An object containing information about the command execution.
- Type
- RunOutput
Examples
command('pnpm prettier --write .'); //=> { output: '', silent: true, isError: false }
command('pnpm prettier --write .', false); //=> { output: '...', silent: false, isError: false }
(static) commandLive(cmd, silentopt) → {RunOutput}
Executes a command synchronously and captures live output.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
cmd |
string | The command to be executed. | ||
silent |
boolean |
<optional> |
false | If true, suppresses output; otherwise, displays live output. |
- Source:
Throws:
-
Throws an error if the command is not provided or not correctly formatted, or if an error occurs during execution.
- Type
- Error
Returns:
A success message if the command is executed successfully, or nothing if there's an error.
- Type
- RunOutput
Examples
commandLive('pnpm next dev'); //=> { output: 'Command exited successfully.', silent: false, isError: false }
commandLive('pnpm next dev', true); //=> { output: '', silent: true, isError: false }
(static) runs(name, runFunction) → {RunsReturn}
Represents a run within a task.
A run must always have a return statement within its function body.
If it does not have one it will be added automatically.
Parameters:
Name | Type | Description |
---|---|---|
name |
string | The name of the run. |
runFunction |
function | RunOutput | The function that defines the run's behavior. |
- Source:
Returns:
An object representing the run.
- Type
- RunsReturn
Example
runs("a passing command", () => {
command("exit 0");
});
(static) task(name, setup, runs, configopt) → {Object}
Represents a task with a setup function and a list of runs.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
name |
string | The name of the task. | |
setup |
function | The setup function to be executed before runs. | |
runs |
Object | An array of runs, each containing a name and a run function. | |
config |
TaskConfig |
<optional> |
An optional configuration object for the task. |
- Source:
Returns:
- The number of passed and failed runs.
- Type
- Object
Example
task(
"a task", // name
() => { // setup
command("exit 0");
},
[ // runs
runs("a passing command", () => {
command("exit 0");
}),
]
);