Bazel rule
A Bazel rule for protobuf-es would be very enticing for me as I've found the bazel/typescript/grpc world to be frustrating and trying to get non-rules_proto_grpc rules to work with Bazel was painful (and eventually gave up). I see that rules_proto_grpc already has some buf rules for linting/etc.
Hey Doron, apologies for the late reply.
We do have a rules_buf repository, but it does not include code generation. From what I've heard from our team, Bazel is quite peculiar about the inputs/outputs and much more restrictive than the proto plugin contract, making a general bazel rule for plugins practically impossible.
That means we would need a rule specific to protobuf-es, and at this point in time, this is out of scope for this project. I am happy to leave this issue open though, and if people express interest, we might be able to provide such a rule.
We have added a plugin option to keep empty files in https://github.com/bufbuild/protobuf-es/pull/229, making it easier to integrate with Bazel:
keep_empty_files=trueBy default, protoc-gen-es (and all other plugins based on @bufbuild/protoplugin) omit empty files from the plugin output. This option disables pruning of empty files, to allow for smooth interoperation with Bazel and similar tooling that requires all output files to be declared ahead of time.
Hi, good news, my company is working on this now.
Hi @alexeagle, I'm interested in generating TypeScript files using buf in bazel. Any documentation or code examples you can point me to for doing this?
@refactornator that's exactly what ts_proto_library does: https://github.com/aspect-build/rules_ts/blob/main/docs/proto.md
Excellent, I'll try that out. Thanks @alexeagle!