Skip to content

[FEATURE] run-script with workspaces should short-circuit on script error #575

@johndiiorio

Description

@johndiiorio

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

run-script with the --workspaces flag will run all workspace scripts, regardless if one script exits with exit code 1. Please see the "Steps to Reproduce" section.

Expected Behavior

I would expect that run-script would short-circuit and not run the other scripts if one fails. Alternatively, a new flag (e.g. --short-circuit) could be introduced to run-script in order to maintain backwards compatibility.

Steps To Reproduce

Consider the following scenario:

  • A root package.json file has "workspaces": ["a", "b", "c"]
  • a/package.json has the script "build": "exit 1"
  • Both b/package.json and c/package.json have the the script "build": "exit 0"

Run npm run build --workspaces and note that all scripts are run.

Environment

  • OS: Windows 10
  • Node: 16.10.0
  • npm: 7.24.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions