nr
  • 👋Welcome
  • Getting Started
    • Install
    • Environment
    • Configuration File
  • Configuration Reference
    • command
    • task
    • script
  • CLI Reference
    • CLI Reference
Powered by GitBook
On this page
  • script
  • name: string
  • options: ScriptOptions
  • timing?: boolean
  1. Configuration Reference

script

PrevioustaskNextCLI Reference

Last updated 2 years ago

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:

nr.config.js
export default ({ script }) => {
    
};

script

This function accepts the following parameters:

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.

options:

Configuration object for the script. Its properties are detailed below.

group?: string

...

description?: string

...

...

timing?: boolean

Default: false

...

Parameter
Type
Description

name

string

Name of the command.

args

Executable and arguments.

options?

Optional configuration.

Return Type
Description

Value that may be provided to script to run the command.

  • [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>]

run: Array<>

This function accepts a name, an array indicating the executable and its arguments, , and an optional options object, . 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 .

may take one of four forms:

ScriptOptions
Instruction
CommandArguments
CommandOptions
execa
CommandArguments
CommandArguments
CommandOptions
CommandThunk
Page cover image