nestjs-sentry
nestjs-sentry copied to clipboard
Make Graphql actually optional
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.
agreed
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)