Skip to main content

Run Scripts

Run package.json scripts by pattern in sequential or parallel mode with no extra dependencies.

Summary

The run-scripts command reads the scripts field from the nearest package.json, matches script names by a prefix pattern (e.g., build:*), and runs them either sequentially (stopping on first failure) or concurrently (reporting all failures).

Why Use This Command?

  • Run related scripts (e.g., build:clean, build:transpile, build:fix-alias) in a single command with no extra dependencies.
  • Choose between sequential execution (for ordered pipelines) and parallel execution (for independent tasks).
  • Get clear exit codes and error messages when a script fails.

Use Cases

  • Build pipelines — Run build:* scripts sequentially so each step depends on the previous one.
  • Development mode — Run dev:* scripts in parallel to start watchers, dev servers, and other tools concurrently.
  • CI/CD checks — Run check:* scripts sequentially or in parallel depending on whether order matters.
  • Cleanup tasks — Run clean:* scripts in parallel since cleanup operations are independent.

Requirements

  • Node.js runtime — Use any Node.js LTS release with either the installed nova CLI or npx.
  • package.json — A valid package.json with a scripts field must exist in the current working directory.

Usage

You can run this command in two ways:

# Original
nova utility run-scripts <pattern> [options]

# Shorthand
nova util run-scr <pattern> [options]

Note: If Nova is installed only locally (inside a project), the command will work only within that project's directory. See the npm docs for details.

Options

FlagDescription
-s, --sequentialRun matched scripts one at a time, stopping on failure.
-p, --parallelRun matched scripts concurrently.

Exactly one of --sequential or --parallel is required. The <pattern> argument supports a trailing wildcard (e.g., build:*) to match all scripts sharing a common prefix, or an exact script name.

Examples

Sequential build pipeline
# Original
nova utility run-scripts 'build:*' --sequential

# Shorthand
nova util run-scr -s 'build:*'
Parallel dev watchers
# Original
nova utility run-scripts 'dev:*' --parallel

# Shorthand
nova util run-scr -p 'dev:*'

Migration from npm-run-all

For users migrating from the npm-run-all workflow, Nova provides equivalent flags under nova utility run-scripts:

CommandEquivalentWhat It Does
nova utility run-scripts 'build:*' --sequentialnpm-run-all --sequential build:*Run matched scripts one at a time
nova utility run-scripts 'dev:*' --parallelnpm-run-all --parallel dev:*Run matched scripts concurrently

After updating your scripts in package.json, npm-run-all can be removed from devDependencies.

Troubleshooting

  • No "package.json" found — Confirm a package.json exists in the current working directory before running the command.
  • No scripts matched — Verify that your pattern matches at least one key in the scripts field. A trailing * matches by prefix (e.g., build:* matches build:clean, build:transpile).
  • Both modes specified — Use either --sequential or --parallel, not both. The command will exit with an error if both are provided.
  • Script fails in sequential mode — Execution stops at the first failure. Fix the failing script and re-run.
  • Script fails in parallel mode — All scripts run to completion. Check the output for which scripts failed.