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

Make monocart-coverage-reports an optional peer dep #537

Merged
merged 2 commits into from
Jun 13, 2024

Conversation

jakebailey
Copy link
Contributor

@jakebailey jakebailey commented Jun 12, 2024

I noticed in 13979a7 that you fixed it being a "required" peer dep by not declaring it at all.

Package managers like pnpm (or others) may use a stricter node_modules layout which would prevent c8 from accessing monocart-coverage-reports because it's not a declared dependency.

Instead of not declaring the dep, you can still use a peer dep but just mark it optional. Users installing c8 will not get monocart-coverage-reports automatically, which I believe is what you intended. But, installing it later will ensure that it's correctly linked.

As an example, see https://github.com/microsoft/TypeChat/blob/ce83b7f63f19786106f82a37ca154bbb579d960b/typescript/package.json#L43-L54, which declares deps on libraries that can plug into TypeChat, but are not hard deps.

(I also find this to more clearly show intent to people reading the package or analyzing their deps.)

package.json Show resolved Hide resolved
Copy link
Owner

@bcoe bcoe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the contribution.

@bcoe bcoe merged commit 3b91fda into bcoe:main Jun 13, 2024
4 checks passed
@jakebailey jakebailey deleted the optional-peer-dep branch June 13, 2024 00:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants