script
Scripts are the entry-point to nr
; they are what the user will reference from the command line to run a group of commands, tasks, or other scripts.
To create a script, use the function at the script
property of the context object passed to your configuration function:
script
script
This function accepts the following parameters:
name: string
name: string
Human friendly name for the script. This will be used for error-reporting and can be used to reference the script in other scripts.
Configuration object for the script. Its properties are detailed below.
group?: string
group?: string
...
description?: string
description?: string
...
...
timing?: boolean
Default: false
...
This function accepts a name, an array indicating the executable and its arguments, CommandArguments
, and an optional options object, CommandOptions
. It will register the command using the provided name
and return a value. To reference a command in a script, use either the return value from command
directly or a string in the format cmd:name
. Commands are executed using execa
.
CommandArguments
may take one of four forms:
[executable]
of type[string]
[executable, positionals]
of type[string, Array<string>]
[executable, flags]
of type[string, Record<string, any>]
[executable, positionals, flags]
of type[string, Array<string>, Record<string, any>]
Last updated