Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

don't stop all other scripts if one exits with non-zero when using pnpm run /regex/ #8705

Closed
1 task done
MrGreenTea opened this issue Oct 26, 2024 · 2 comments
Closed
1 task done

Comments

@MrGreenTea
Copy link

MrGreenTea commented Oct 26, 2024

Contribution

Describe the user story

We have multiple linters in our astro project (eslint, astro-check, svelte-check) and have structure like this:

"scripts": {
  "lint:eslint": "eslint .",
  "lint:svelte": "svelte-check",
  "lint:astro": "astro check"
}

We then use pnpm run /^lint:/ to run all linters in parallel. When one linter finds issues and stops with a non-zero exit code all other still running linters are killed. This means we don't get all lint issues in our CI for example and sometimes fix one found issue to find another one by a different linter when running all lints again.

Describe the solution you'd like

An option similar to the proposed #6792 but kind of opposite: wait until all scripts have stopped running and then return with the exit code of the first failed script.

npm-run-all calls this option --continue-on-error. Another option might be --wait-for-all

Describe the drawbacks of your solution

One drawback: we lose the specific exit codes of the scripts that failed after the first one.

Also the additional logic of wether to stop the execution might add non-trivial complexity.

Describe alternatives you've considered

I've considered writing a small script or use npm-run-all. The latter hasn't been updated and I would like to avoid the additional dependency, because I really like that we can new lint:XXX scripts and they will be run in our CI.

@btea
Copy link
Member

btea commented Nov 30, 2024

It looks like the bail option will meet your needs. https://pnpm.io/cli/recursive#--no-bail

@MrGreenTea
Copy link
Author

It does. I must have missed that in my search of the docs. Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants