@nrwl/workspace:run-commands

Create a custom target to run any command.

Usage

nx generate run-commands ...
nx g run-command ... #same

By default, Nx will search for run-commands in the default collection provisioned in workspace.json.

You can specify the collection explicitly as follows:

nx g @nrwl/workspace:run-commands ...

Show what will be generated without writing to disk:

nx g run-commands ... --dry-run

Examples

Add the printhello target to my-feature-lib:

nx g @nrwl/workspace:run-commands printhello --project my-feature-lib --command 'echo hello'

Options

command

Required
string

Command to run.

name

Required
string

Target name.

project

Required
string

Project name.

cwd

string

Current working directory of the command.

envFile

string

Env files to be loaded before executing the commands.

outputs

string

Allows you to specify where the build artifacts are stored. This allows Nx Cloud to pick them up correctly, in the case that the build artifacts are placed somewhere other than the top level dist folder.