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
fix: remove long import #7
Conversation
@andreialecu: Thank you for submitting a pull request! Before we can merge it, you'll need to sign the Apollo Contributor License Agreement here: https://contribute.apollographql.com/ |
I signed the agreement, not sure if anything else needs to be done on my part. |
@kiancross note that there's a normal dependency on Lines 55 to 56 in 757f6e3
Adding it as a peer on top of that doesn't really do anything. |
Also, |
This comment has been minimized.
This comment has been minimized.
16ecc2d
to
0473ffb
Compare
Thanks! I didn't realize I wasn't watching this fork until now. Taking a look but I think this is basically what I want — I even added a TODO in apollo-server earlier this week to do something like that. |
it can be added via a cli arg as `-i Long` instead, if needed
Force pushing to just have the real change and not some release stuff from master. Thanks! |
See apollographql/protobuf.js#7 A future version could fully remove Long support from our fork but we aren't quite there yet.
This doesn't quite work — once you run various build scripts it removes the import from the |
OK, I think I got it working; this is out in |
Apollo Server 2.24.0 is out and should include this fix transitively. |
In the base repo the PR that added this was eventually reverted:
protobufjs#1166
@apollo/protobufjs
package is only used byapollo-reporting-protobuf
which explicitly forces only numbers to be used, and actually disablesLong
entirely (via--force-number
):https://github.com/apollographql/apollo-server/blob/fe7df736abdb6bcebf2353902f1b40bee2f9ea5c/packages/apollo-reporting-protobuf/package.json#L10
https://github.com/apollographql/apollo-server/blob/fe7df736abdb6bcebf2353902f1b40bee2f9ea5c/packages/apollo-reporting-protobuf/src/index.js#L4-L8
Without this change,
Long
is unnecessarily added as an import to the typescript definitions:https://cdn.jsdelivr.net/npm/apollo-reporting-protobuf@0.6.2/dist/protobuf.d.ts
Note that if you search for long in the file, there are no mentions of it besides the first line/import.
Keeping the import there breaks stricter package managers, such as Yarn 2 in PnP mode:
Requiring to work around it via
packageExtensions
Long
can be added back in the future to the.d.ts
, if ever needed, via a cli argument (-i Long
). As per:https://github.com/apollographql/protobuf.js/blob/master/cli/pbts.js#L176-L179
This PR supersedes #6 which attempts to solve the same problem.