Skip to content

Commit

Permalink
Small update to docs
Browse files Browse the repository at this point in the history
  • Loading branch information
mrmeku committed Apr 16, 2024
1 parent 98bba9b commit 987b6ac
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 9 deletions.
6 changes: 3 additions & 3 deletions docs/proto.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,9 @@ ts_proto_library(<a href="#ts_proto_library-name">name</a>, <a href="#ts_proto_l
| :------------- | :------------- | :------------- |
| <a id="ts_proto_library-name"></a>name | name of resulting ts_proto_library target | none |
| <a id="ts_proto_library-node_modules"></a>node_modules | Label pointing to the linked node_modules target where @bufbuild/protoc-gen-es is linked, e.g. //:node_modules. Since the generated code depends on @bufbuild/protobuf, this package must also be linked. If <code>gen_connect_es = True</code> then @bufbuild/proto-gen-connect-es should be linked as well. If <code>gen_connect_query = True</code> then @bufbuild/proto-gen-connect-query should be linked as well. | none |
| <a id="ts_proto_library-gen_connect_es"></a>gen_connect_es | whether the proto file contains a service, and therefore *_connect.{js,d.ts} should be written. | <code>True</code> |
| <a id="ts_proto_library-gen_connect_query"></a>gen_connect_query | whether the proto file contains a service, and therefore *_connect.{js,d.ts} should be written. | <code>False</code> |
| <a id="ts_proto_library-gen_connect_query_service_mapping"></a>gen_connect_query_service_mapping | mapping from source proto file to the named RPC services that file contains. For example, if I have a.proto which contains a service Foo and b.proto that contains a service Bar, the mapping I would pass would be: <code>gen_connect_query_service_mapping = {"a.proto": ["Foo"], "b.proto": ["Bar"]}</code> See https://github.com/connectrpc/connect-query-es/tree/main/examples/react/basic/src/gen | <code>{}</code> |
| <a id="ts_proto_library-gen_connect_es"></a>gen_connect_es | whether to generate grpc services via protoc_gen_connect_es and therefore *_connect.{js,d.ts} should be written. | <code>True</code> |
| <a id="ts_proto_library-gen_connect_query"></a>gen_connect_query | whether to generate TanStack Query clients via protoc_gen_connect_query, and therefore *_connectquery.{js,d.ts} should be written. | <code>False</code> |
| <a id="ts_proto_library-gen_connect_query_service_mapping"></a>gen_connect_query_service_mapping | mapping from source proto file to the named RPC services that file contains. Used to derive which files will be generated by gen_connect_query. See https://github.com/connectrpc/connect-query-es/tree/main/examples/react/basic/src/gen<br><br>For example, if I have a.proto which contains a service Foo and b.proto that contains a service Bar, the mapping I would pass would be: <code>gen_connect_query_service_mapping = {"a.proto": ["Foo"], "b.proto": ["Bar"]}</code> | <code>{}</code> |
| <a id="ts_proto_library-copy_files"></a>copy_files | whether to copy the resulting .d.ts files back to the source tree, for the editor to locate them. | <code>True</code> |
| <a id="ts_proto_library-files_to_copy"></a>files_to_copy | which files from the protoc output to copy. By default, scans for *.proto in the current package and replaces with the typical output filenames. | <code>None</code> |
| <a id="ts_proto_library-kwargs"></a>kwargs | additional named arguments to the ts_proto_library rule | none |
Expand Down
6 changes: 3 additions & 3 deletions ts/private/ts_proto_library.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -117,11 +117,11 @@ ts_proto_library = rule(
default = True,
),
"gen_connect_query": attr.bool(
doc = "whether to generate service stubs with gen-connect-query",
doc = "whether to generate TanStack Query clients with gen-connect-query",
default = False,
),
"gen_connect_query_service_mapping": attr.string_list_dict(
doc = "what services to generate for connect-query",
doc = "mapping from protos to services those protos contain used to dervice file names for gen-connect-query",
default = {},
),
"proto": attr.label(
Expand All @@ -142,7 +142,7 @@ ts_proto_library = rule(
cfg = "exec",
),
"protoc_gen_connect_query": attr.label(
doc = "protoc plugin to generate react query services",
doc = "protoc plugin to generate TanStack Query services",
executable = True,
cfg = "exec",
),
Expand Down
8 changes: 5 additions & 3 deletions ts/proto.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,15 @@ def ts_proto_library(name, node_modules, gen_connect_es = True, gen_connect_quer
Since the generated code depends on @bufbuild/protobuf, this package must also be linked.
If `gen_connect_es = True` then @bufbuild/proto-gen-connect-es should be linked as well.
If `gen_connect_query = True` then @bufbuild/proto-gen-connect-query should be linked as well.
gen_connect_es: whether the proto file contains a service, and therefore *_connect.{js,d.ts} should be written.
gen_connect_query: whether the proto file contains a service, and therefore *_connect.{js,d.ts} should be written.
gen_connect_es: whether to generate grpc services via protoc_gen_connect_es and therefore *_connect.{js,d.ts} should be written.
gen_connect_query: whether to generate TanStack Query clients via protoc_gen_connect_query, and therefore *_connectquery.{js,d.ts} should be written.
gen_connect_query_service_mapping: mapping from source proto file to the named RPC services that file contains.
Used to derive which files will be generated by gen_connect_query.
See https://github.com/connectrpc/connect-query-es/tree/main/examples/react/basic/src/gen
For example, if I have a.proto which contains a service Foo and b.proto that contains a service Bar,
the mapping I would pass would be:
`gen_connect_query_service_mapping = {"a.proto": ["Foo"], "b.proto": ["Bar"]}`
See https://github.com/connectrpc/connect-query-es/tree/main/examples/react/basic/src/gen
copy_files: whether to copy the resulting .d.ts files back to the source tree, for the editor to locate them.
files_to_copy: which files from the protoc output to copy. By default, scans for *.proto in the current package
and replaces with the typical output filenames.
Expand Down

0 comments on commit 987b6ac

Please sign in to comment.