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
novaCLI ornpx. - package.json — A valid
package.jsonwith ascriptsfield must exist in the current working directory.
Usage
You can run this command in two ways:
- nova (installed)
- npx (no install)
# 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.
# Original
npx --yes @cbnventures/nova@latest utility run-scripts <pattern> [options]
# Shorthand
npx --yes @cbnventures/nova@latest util run-scr <pattern> [options]
Note: If you prefer the shorter nova command, see the Setup and Configure guide for installation instructions.
Options
| Flag | Description |
|---|---|
-s, --sequential | Run matched scripts one at a time, stopping on failure. |
-p, --parallel | Run 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
- nova (installed)
- npx (no install)
# Original
nova utility run-scripts 'build:*' --sequential
# Shorthand
nova util run-scr -s 'build:*'
# Original
nova utility run-scripts 'dev:*' --parallel
# Shorthand
nova util run-scr -p 'dev:*'
# Original
npx --yes @cbnventures/nova@latest utility run-scripts 'build:*' --sequential
# Shorthand
npx --yes @cbnventures/nova@latest util run-scr -s 'build:*'
# Original
npx --yes @cbnventures/nova@latest utility run-scripts 'dev:*' --parallel
# Shorthand
npx --yes @cbnventures/nova@latest 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:
| Command | Equivalent | What It Does |
|---|---|---|
nova utility run-scripts 'build:*' --sequential | npm-run-all --sequential build:* | Run matched scripts one at a time |
nova utility run-scripts 'dev:*' --parallel | npm-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.jsonexists in the current working directory before running the command. - No scripts matched — Verify that your pattern matches at least one key in the
scriptsfield. A trailing*matches by prefix (e.g.,build:*matchesbuild:clean,build:transpile). - Both modes specified — Use either
--sequentialor--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.