sourcegraph/client/shared/dev/generate_graphql_operations.bzl
Jason Bedard 10aefc4bb7
bazel: add bazel build,tests for client/* (#46193)
Webpack bundles compile but need further testing. Jest + mocha tests
compile but are marked as `manual` until further work is done to get them
passing. The four jest tests are green and enabled now, though.

## Test plan

`bazel build //client/...` and `bazel test //client/...`
2023-02-28 20:46:03 -08:00

29 lines
1.1 KiB
Python

load("@aspect_rules_js//js:defs.bzl", "js_run_binary")
def generate_graphql_operations(name, interface_name, srcs, out, **kwargs):
"""Generate a graphql operations Typescript interface.
Args:
name: Name of the target
interface_name: Name of the generated TypeScript interface. Must match one of the
interfaces precoded in generateGraphQlOperations.js.
srcs: Files required by the glob to generate the interface. Should include all files
in the glob pattern specified in generateGraphQlOperations.js. The files should be
produced in or copied to the Bazel output tree, so it's recommended to use js_library
with a glob pattern equivalent to the one in generateGraphQlOperations.js.
out: Name of the typescript file to output.
**kwargs: general args
"""
js_run_binary(
name = name,
outs = [out],
srcs = srcs,
args = [
interface_name,
out,
],
chdir = native.package_name(),
tool = "//client/shared/dev:generate_graphql_operations",
**kwargs
)