Skip to content

Commit 121ab9f

Browse files
committed
fixup! docs: generate adev-compatible api json
1 parent 6d21dc8 commit 121ab9f

File tree

2 files changed

+9
-29
lines changed

2 files changed

+9
-29
lines changed

tools/adev-api-extraction/BUILD.bazel

Lines changed: 6 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,9 @@
1-
load("@build_bazel_rules_nodejs//:index.bzl", "nodejs_binary")
2-
load("@aspect_rules_esbuild//esbuild:defs.bzl", "esbuild")
1+
load("@aspect_rules_js//js:defs.bzl", "js_binary")
32
load("//tools:defaults.bzl", "ts_project")
4-
load("@aspect_rules_ts//ts:defs.bzl", rules_js_tsconfig = "ts_config")
3+
load("@aspect_rules_ts//ts:defs.bzl", "ts_config")
54

65
package(default_visibility = ["//visibility:public"])
76

8-
esbuild(
9-
name = "bin",
10-
bundle = True,
11-
entry_point = ":index.ts",
12-
external = [
13-
"typescript",
14-
],
15-
format = "esm",
16-
output = "bin.mjs",
17-
platform = "node",
18-
target = "es2022",
19-
deps = [
20-
":extract_api_to_json_lib",
21-
"//:node_modules/@angular/compiler-cli",
22-
],
23-
)
24-
257
ts_project(
268
name = "extract_api_to_json_lib",
279
srcs = glob(
@@ -42,18 +24,13 @@ ts_project(
4224
)
4325

4426
# Action binary for the api_gen bazel rule.
45-
nodejs_binary(
27+
js_binary(
4628
name = "extract_api_to_json",
4729
data = [
48-
":bin",
30+
":extract_api_to_json_lib",
4931
"//:node_modules/typescript",
5032
],
51-
entry_point = "bin.mjs",
52-
# Note: Using the linker here as we need it for ESM. The linker is not
53-
# super reliably when running concurrently on Windows- but we have existing
54-
# actions using the linker. An alternative would be to:
55-
# - bundle the Angular compiler into a CommonJS bundle
56-
# - use the patched resolution- but also patch the ESM imports (similar to how FW does it).
33+
entry_point = "index.js",
5734
visibility = ["//visibility:public"],
5835
)
5936

@@ -63,7 +40,7 @@ filegroup(
6340
srcs = glob(["**/*"]),
6441
)
6542

66-
rules_js_tsconfig(
43+
ts_config(
6744
name = "tsconfig",
6845
src = "tsconfig.json",
6946
deps = ["//:node_modules/@types/node"],

tools/adev-api-extraction/extract_api_to_json.bzl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,9 @@ def _extract_api_to_json(ctx):
5252
executable = "_extract_api_to_json",
5353
outputs = [json_output],
5454
arguments = [args],
55+
env = {
56+
"BAZEL_BINDIR": ctx.bin_dir.path,
57+
},
5558
)
5659

5760
# The return value describes what the rule is producing. In this case we need to specify

0 commit comments

Comments
 (0)