Skip to content

Make Graphql actually optional #71

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

Open
zackdotcomputer opened this issue Jan 25, 2022 · 2 comments
Open

Make Graphql actually optional #71

zackdotcomputer opened this issue Jan 25, 2022 · 2 comments

Comments

@zackdotcomputer
Copy link

zackdotcomputer commented Jan 25, 2022

The package.json lists the dependency on @nestjs/graphql under optionalDependencies

I think the intention here was to express "if you use graphql, we are compatible with these versions." However, optionalDependencies is interpreted by npm to mean "install this if possible."

This means the only way to avoid a single optional dependency that is compatible with your engine is to suppress all of them with npm ci --no-optional, so if you add this package you get saddled with all the NestJS graphql packages in your node_modules even if you're not using them.

I think the ideal would be for the repository would publish two packages: @ntegral/nestjs-sentry and @ntegral/nestjs-sentry-graphql. The latter would have a peerDependency on the graphql packages and the former skipping any mention of graphql.

@onhate
Copy link

onhate commented Feb 24, 2022

agreed

@zackdotcomputer
Copy link
Author

Since there's been no move on this for a while, I created a fork that solves this problem: https://github.com/travelerdev/nestjs-sentry

This separates out two packages @travelerdev/nestjs-sentry and @travelerdev/nestjs-sentry-graphql which are identical except that the latter includes the peer dependency on the Nest Graphql package and exports the graphql interceptor, while the former doesn't.

(It also upgrades to NestJS 9.x support and Sentry 7.x)

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

No branches or pull requests

2 participants