-
Notifications
You must be signed in to change notification settings - Fork 32
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
Support for grpc-node #10
Comments
I think it would be doable, I'm happy to accept a PR to add support for it. I think it would make sense to have different rules/macros, e.g. |
I got something working 10 minutes after posting my issue, although it required a smaller change in ts-protoc-gen as well. I assume we want ts-protoc-gen to just generate the base d.ts+friends, and then optionally a use the other rules, to just generate the grpc-web / grpc-node services, right? |
Waiting for the outcome of improbable-eng/ts-protoc-gen#211 to start writing the implementation here. The proposal would also make the implementation here simpler, I reckon. |
Yes, something like:
Sounds good. |
@Dig-Doug Would it make more sense to add a It matches more the approach I ended up working on here: improbable-eng/ts-protoc-gen#212 Example:
The above would generate the same thing as |
One issue I can think of with that approach is users may not want to include all of the generated code in all of there builds. For example, I may have two apps A and B, one using grpc-node and one using gprc-web. If I depend on the single "example" rule, I get both sets of generated code. Having two different targets makes it very clear what is generated by each one. Another thing is that specifying raw string input params is not ideal because it's error prone: there can be typos, etc. However, under the hood you could still have a single implementation with input params - just hide those details from the user using a macro. E.g. # typescript_grpc_web_library.bzl
# Define a macro to hide the input params
def typescript_grpc_web_library(name):
typescript_proto_library_impl(
name = name,
generate = "grpc-web",
) # user's BUILD.bazel
typescript_grpc_web_library(
name = "pizza_grpc_web_proto",
...
) Finally, the main java and c++ rules also separate the libraries, e.g. |
I have something working locally now, that adds It is breaking backwards compatibility, as |
That's fine, it doesn't need to be backwards compatible - you'll just need to document how people should update example. |
@Multiply Is there a commit or PR for this which I could cherry-pick to try out? |
@kellycampbell You can check this out https://github.com/thesayyn/protoc-gen-ts |
We ended up a different route dropping typescript entirely for now. If we revisit typescript down the road, I might be allocated more time to flesh the last details out. |
Would it be feasible to support
service=grpc-node
as well asservice=grpc-web
?The text was updated successfully, but these errors were encountered: