Conversation
| # By default, only the proto files passed as input to protoc are generated, not the files they | ||
| # import (with the exception of well-known types which are always generated when imported). | ||
| # generate_dependencies generates code for dependencies too. |
There was a problem hiding this comment.
I believe that the wording here is wrong; we are still passing the whole directory of compiled protos to the plugin like before, this option lets the plugin figure out what to generate based on the list of files we are asking it to generate (in the paths list) instead of having to trim down the list ourselves.
There was a problem hiding this comment.
This is copied from protobuf-ts docs, minus the last paragraph. 😏 We no longer have to manually include dependencies in the list so I think the comment is correct.
There was a problem hiding this comment.
I can see where their interpretation and my misunderstanding comes from; by "the proto files passed as input" they mean the list of proto files - all dependencies are always compiled and passed to the plugin. I doublechecked the implementation because the wording makes it seem like protobuf-ts goes and reads extra files independently, which thankfully is not what's happening.
|
@ravicious See the table below for backport results.
|
* Automatically generate code for imported protos * Put protobuf-ts opts in alphabetical order
protobuf-ts has the
generate_dependenciesoption:In the past, we imported some protos from
api/proto/teleportinproto/teleport/lib/teleterm. We had to add a couple of additional inputs inbuf-ts.gen.yaml, otherwise Vite would fail when trying to compile the generated protos – they'd try to import paths that don't exist.With this option, we can specify as inputs only the paths that we really need and protobuf-ts will automatically pull in any imported protos. As you can see in the diff, it reduces the amount of generated code.
I verified that this doesn't break anything by running
pnpm build-term,pnpm build-ui-oss, andpnpm build-ui-e. If any actually used files were missing, those commands would fail.In the next PR, I'm going to move
web/packages/teleterm/src/sharedProcess/api/proto/ptyHostService.prototoproto/teleport/web/teleterm.