nestjs-sentry icon indicating copy to clipboard operation
nestjs-sentry copied to clipboard

Make Graphql actually optional

Open zackdotcomputer opened this issue 3 years ago • 2 comments

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.

zackdotcomputer avatar Jan 25 '22 15:01 zackdotcomputer

agreed

onhate avatar Feb 24 '22 20:02 onhate

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)

zackdotcomputer avatar Sep 01 '22 12:09 zackdotcomputer