grpc / grpc-web

gRPC for Web Clients
https://grpc.io
Apache License 2.0
8.51k stars 766 forks source link

Bazel rules for grpc-web commonjs and typescript #1221

Closed dangars closed 2 years ago

dangars commented 2 years ago

Hi, Thanks a lot for the great work with grpc-web!

Would it be possible to add Bazel rules for grpc-web commonjs and typescript? Or explain in the documentation how to use grpc-web with Bazel.

I can see that in the past there was a closure rule, but I think that it was removed in #1138

Thanks

sampajano commented 2 years ago

@dangars Thank you! And thanks for asking! :)

Unfortunately, we've decided to move away from Bazel in our toolchain, as it has become a hindrance for our development, as mentioned in the summary of https://github.com/grpc/grpc-web/pull/1138 as you've referred to.. :)

For most users, the "closure" rule isn't really required. All you need is to install the npm package and run a protoc command to generate the client stubs, as can be followed in the hello world example, so a complex Bazel rule is probably not needed (if you want you use Bazel for your build process you could write a custom rule one yourself which should be simple to do too).

Hope that helps :)

dangars commented 2 years ago

@sampajano Thanks a lot for your reply!

I agree it should be easy to write a simple custom rule :)

attali97 commented 1 year ago

@sampajano @dangars Could you have an example custom rule to support grpc-web? Thanks so much! I'm new to bazel and get stuck on this for days. I found a lib https://github.com/rules-proto-grpc/rules_proto_grpc but it depends on a deprecated lib https://github.com/bazelbuild/rules_nodejs, which raised a bunch of problems.

j-effrey commented 6 months ago

@dangars @sampajano I want to avoid creating a new issue. How did you manage to create a Bazel rule? Better documentation would be greatly appreciated, as we do not want to have to run the command to generate the protobuf code and instead, want to have Bazel take care of it for us.