Skip to content

Add --continue-on-error option to pnpm run #7381

Description

@mizdra

Contribution

Describe the user story

I often register npm-scripts in package.json that run some static analysis. For example, lint:tsc to run tsc, lint:eslint to run eslint and lint:prettier to run prettier.

I also register an npm-script that runs them in batches. The script is run on CI.

I now use npm-run-all for this script and write it as follows.

{
  "scripts": {
    "lint": "run-s --continue-on-error lint:*",
    "lint:eslint": "eslint .",
    "lint:tsc": "tsc --noEmit",
    "lint:prettier": "prettier --check ."
  }
}

I would like to do this same thing with pnpm run:

{
  "scripts": {
    "lint": "pnpm run --sequential '/lint:[^:]+/'",
    "lint:eslint": "eslint .",
    "lint:tsc": "tsc --noEmit",
    "lint:prettier": "prettier --check ."
  }
}

However, the script seems to abort execution of the other sub-scripts as soon as any of them terminate with an error. For example, if lint:tsc exits with an error, it may interrupt lint:eslint or lint:prettier before they complete.

This behaviour does not fit my use case. I want to find more problems in one run of the lint script.

example: https://github.com/mizdra/pnpm-feature-request-continue-on-error

Describe the solution you'd like

Add the --continue-on-error option to pnpm run, like npm-run-all. This option allows other scripts to continue running even if a sub-script exits. When all scripts have completed, the parent script is terminated with an error.

This option should work whether the sub-scripts are executed in parallel (--no-sequential) or in series (--sequential).

Describe the drawbacks of your solution

When an error occurs in two sub-scripts, it is not clear what the error code of the parent script will be. Should it be the error code of either sub-script? Or should it be a different error code? The npm-run-all implementation might help with this, but I don't know about it yet.

Describe alternatives you've considered

None.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions