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

Please add --fail-if-not-present #5569

Closed
1 task
matthew-dean opened this issue Oct 31, 2022 · 2 comments · Fixed by #5802
Closed
1 task

Please add --fail-if-not-present #5569

matthew-dean opened this issue Oct 31, 2022 · 2 comments · Fixed by #5802
Milestone

Comments

@matthew-dean
Copy link

Describe the user story

As a developer and maintainer of a monorepo, I'd like to enforce that everyone adds a test:ci script to any new packages, as there's a PNPM command that we run: pnpm -r test:ci. However, this script will silently skip any packages that don't have that script.

Describe the solution you'd like

We would want PNPM to check recursively that the script exists. Right now, there's a --if-present flag (which is not required for recursive script, and is added implicitly). So, it would be great for there to be a --fail-if-not-present flag.

Describe the drawbacks of your solution

No drawbacks. Existing behavior would stay the same.

Describe alternatives you've considered

To my knowledge, no NPM packages that I can find do this kind of checking for a script being defined in all monorepo packages, and IMO this is more the responsibility of the script runner (in this case, PNPM).

@zkochan
Copy link
Member

zkochan commented Oct 31, 2022

It might be better to support a new setting that lists the required scripts.

Like

{
  "pnpm": {
    "requiredScripts": ["test:ci"]
  }
}

@matthew-dean
Copy link
Author

👍

zkochan added a commit that referenced this issue Dec 20, 2022
close #5569

Co-authored-by: Zoltan Kochan <z@kochan.io>
@zkochan zkochan added this to the v7.19 milestone Dec 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants