Skip to content

Commit

Permalink
chore: update to latest stardoc (#602)
Browse files Browse the repository at this point in the history
  • Loading branch information
gregmagolan authored Apr 30, 2024
1 parent df40a70 commit e8e97de
Show file tree
Hide file tree
Showing 13 changed files with 173 additions and 164 deletions.
6 changes: 1 addition & 5 deletions .github/workflows/release_prep.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,7 @@ Add to your \`MODULE.bazel\` file:
\`\`\`starlark
bazel_dep(name = "aspect_rules_ts", version = "${TAG:1}")
rules_ts_ext = use_extension(
"@aspect_rules_ts//ts:extensions.bzl",
"ext",
dev_dependency = True,
)
rules_ts_ext = use_extension("@aspect_rules_ts//ts:extensions.bzl", "ext", dev_dependency = True)
rules_ts_ext.deps()
Expand Down
23 changes: 13 additions & 10 deletions MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -6,26 +6,29 @@ module(
compatibility_level = 1,
)

bazel_dep(name = "bazel_skylib", version = "1.4.1")
bazel_dep(name = "aspect_rules_js", version = "1.34.0")
bazel_dep(name = "aspect_bazel_lib", version = "1.38.1")
bazel_dep(name = "aspect_bazel_lib", version = "1.40.2")
bazel_dep(name = "aspect_rules_jasmine", version = "1.1.1")

# Similar to rules_python/MODULE.bazel, see https://github.com/bazelbuild/rules_python/pull/832
# These are loaded only when using ts_proto_library
bazel_dep(name = "rules_proto", version = "5.3.0-21.7")
bazel_dep(name = "aspect_rules_js", version = "1.34.0")
bazel_dep(name = "bazel_skylib", version = "1.4.1")
bazel_dep(name = "platforms", version = "0.0.5")

# Only needed because rules_proto doesn't provide the protoc toolchain yet.
# TODO(alex/sahin): remove in the future
bazel_dep(name = "protobuf", version = "21.7", repo_name = "com_google_protobuf")

# Similar to rules_python/MODULE.bazel, see https://github.com/bazelbuild/rules_python/pull/832
# These are loaded only when using ts_proto_library
bazel_dep(name = "rules_proto", version = "5.3.0-21.7")

####### Dev dependencies ########

bazel_dep(name = "aspect_rules_lint", version = "0.9.1", dev_dependency = True)
bazel_dep(name = "bazel_skylib_gazelle_plugin", version = "1.5.0", dev_dependency = True)
bazel_dep(name = "buildifier_prebuilt", version = "6.4.0", dev_dependency = True)
bazel_dep(name = "rules_nodejs", version = "5.8.2", dev_dependency = True)
bazel_dep(name = "gazelle", version = "0.36.0", dev_dependency = True, repo_name = "bazel_gazelle")
bazel_dep(name = "bazel_skylib_gazelle_plugin", version = "1.5.0", dev_dependency = True)
bazel_dep(name = "aspect_rules_lint", version = "0.9.1", dev_dependency = True)
bazel_dep(name = "rules_go", version = "0.46.0", dev_dependency = True, repo_name = "io_bazel_rules_go")
bazel_dep(name = "rules_nodejs", version = "5.8.2", dev_dependency = True)
bazel_dep(name = "stardoc", version = "0.6.2", dev_dependency = True, repo_name = "io_bazel_stardoc")

npm = use_extension(
"@aspect_rules_js//npm:extensions.bzl",
Expand Down
31 changes: 23 additions & 8 deletions WORKSPACE
Original file line number Diff line number Diff line change
@@ -1,11 +1,4 @@
# Declare the local Bazel workspace.
workspace(
# If your ruleset is "official"
# (i.e. is in the bazelbuild GitHub org)
# then this should just be named "rules_ts"
# see https://docs.bazel.build/versions/main/skylark/deploying.html#workspace
name = "aspect_rules_ts",
)
workspace(name = "aspect_rules_ts")

load(":internal_deps.bzl", "rules_ts_internal_deps")

Expand Down Expand Up @@ -59,6 +52,28 @@ go_register_toolchains(version = "1.19.3")

gazelle_dependencies()

############################################
# Stardoc
load("@io_bazel_stardoc//:setup.bzl", "stardoc_repositories")

stardoc_repositories()

load("@rules_jvm_external//:repositories.bzl", "rules_jvm_external_deps")

rules_jvm_external_deps()

load("@rules_jvm_external//:setup.bzl", "rules_jvm_external_setup")

rules_jvm_external_setup()

load("@io_bazel_stardoc//:deps.bzl", "stardoc_external_deps")

stardoc_external_deps()

load("@stardoc_maven//:defs.bzl", stardoc_pinned_maven_install = "pinned_maven_install")

stardoc_pinned_maven_install()

# Buildifier
load("@buildifier_prebuilt//:deps.bzl", "buildifier_prebuilt_deps")

Expand Down
20 changes: 19 additions & 1 deletion docs/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,38 @@ load("@aspect_bazel_lib//lib:docs.bzl", "stardoc_with_diff_test", "update_docs")
stardoc_with_diff_test(
name = "rules",
bzl_library_target = "//ts:defs",
tags = [
"skip-on-bazel6",
"skip-on-rbe",
],
)

stardoc_with_diff_test(
name = "proto",
bzl_library_target = "//ts:proto",
tags = [
"skip-on-bazel6",
"skip-on-rbe",
],
)

stardoc_with_diff_test(
name = "repositories",
bzl_library_target = "//ts:repositories",
symbol_names = ["rules_ts_dependencies"],
tags = [
"skip-on-bazel6",
"skip-on-rbe",
],
)

update_docs(name = "update")
update_docs(
name = "update",
tags = [
"skip-on-bazel6",
"skip-on-rbe",
],
)

# Demonstration delivery target for Aspect Workflows.
# In the future this could be wired up to push to a demonstration S3 bucket.
Expand Down
15 changes: 7 additions & 8 deletions docs/proto.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ Future work
- Allow users to choose other plugins. We intend to wait until http://github.com/bazelbuild/rules_proto supports protoc plugins.
- Allow users to control the output format. Currently it is hard-coded to `js+dts`, and the JS output uses ES Modules.


<a id="ts_proto_library"></a>

## ts_proto_library
Expand All @@ -52,20 +51,20 @@ ts_proto_library(<a href="#ts_proto_library-name">name</a>, <a href="#ts_proto_l
<a href="#ts_proto_library-gen_connect_query_service_mapping">gen_connect_query_service_mapping</a>, <a href="#ts_proto_library-copy_files">copy_files</a>, <a href="#ts_proto_library-files_to_copy">files_to_copy</a>, <a href="#ts_proto_library-kwargs">kwargs</a>)
</pre>

A macro to generate JavaScript code and TypeScript typings from .proto files.
A macro to generate JavaScript code and TypeScript typings from .proto files.

**PARAMETERS**


| Name | Description | Default Value |
| :------------- | :------------- | :------------- |
| <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 protoc_gen_connect_es should generate grpc services, and therefore <code>*_connect.{js,d.ts}</code> should be written. | <code>True</code> |
| <a id="ts_proto_library-gen_connect_query"></a>gen_connect_query | whether protoc_gen_connect_query should generate [TanStack Query](https://tanstack.com/query) clients, and therefore <code>*_connectquery.{js,d.ts}</code> 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. Needed to predict 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, given <code>a.proto</code> which contains a service <code>Foo</code> and <code>b.proto</code> that contains a service <code>Bar</code>, the mapping would be <code>{"a.proto": ["Foo"], "b.proto": ["Bar"]}</code> | <code>{}</code> |
| <a id="ts_proto_library-copy_files"></a>copy_files | whether to copy the resulting <code>.d.ts</code> 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-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 `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. | none |
| <a id="ts_proto_library-gen_connect_es"></a>gen_connect_es | whether protoc_gen_connect_es should generate grpc services, and therefore `*_connect.{js,d.ts}` should be written. | `True` |
| <a id="ts_proto_library-gen_connect_query"></a>gen_connect_query | whether protoc_gen_connect_query should generate [TanStack Query](https://tanstack.com/query) clients, and therefore `*_connectquery.{js,d.ts}` should be written. | `False` |
| <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. Needed to predict 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, given `a.proto` which contains a service `Foo` and `b.proto` that contains a service `Bar`, the mapping would be `{"a.proto": ["Foo"], "b.proto": ["Bar"]}` | `{}` |
| <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. | `True` |
| <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. | `None` |
| <a id="ts_proto_library-kwargs"></a>kwargs | additional named arguments to the ts_proto_library rule | none |


7 changes: 3 additions & 4 deletions docs/repositories.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit e8e97de

Please sign in to comment.