Skip to content

Commit d22f48c

Browse files
devversionjelbourn
authored andcommitted
build: package material api docs into npm package (#14508)
1 parent 9914970 commit d22f48c

File tree

39 files changed

+208
-10
lines changed

39 files changed

+208
-10
lines changed

src/BUILD.bazel

+7-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
11
package(default_visibility = ["//visibility:public"])
22

3-
load("//:packages.bzl", "CDK_PACKAGES")
3+
load("//:packages.bzl", "CDK_PACKAGES", "MATERIAL_PACKAGES")
44
load("//tools:defaults.bzl", "ts_library")
55
load("//tools/dgeni:index.bzl", "dgeni_api_docs")
66

7+
# List that contains all source files that need to be processed by Dgeni.
8+
apiSourceFiles = ["//src/cdk/%s:source-files" % name for name in CDK_PACKAGES] + [
9+
"//src/lib/%s:source-files" % name for name in MATERIAL_PACKAGES]
10+
711
exports_files([
812
"bazel-tsconfig-build.json",
913
"bazel-tsconfig-test.json",
@@ -17,13 +21,14 @@ ts_library(
1721

1822
dgeni_api_docs(
1923
name = "api-docs",
20-
srcs = ["//src/cdk/%s:source-files" % name for name in CDK_PACKAGES] + [
24+
srcs = apiSourceFiles + [
2125
# Add all Angular packages to the sources because some Material exports use
2226
# Angular exports and these should not cause any warnings when Dgeni uses the
2327
# type checker to parse our TypeScript sources.
2428
"@matdeps//@angular"
2529
],
2630
entry_points = {
2731
"cdk": CDK_PACKAGES,
32+
"material": MATERIAL_PACKAGES,
2833
},
2934
)

src/lib/autocomplete/BUILD.bazel

+5
Original file line numberDiff line numberDiff line change
@@ -72,3 +72,8 @@ markdown_to_html(
7272
name = "overview",
7373
srcs = [":autocomplete.md"],
7474
)
75+
76+
filegroup(
77+
name = "source-files",
78+
srcs = glob(["**/*.ts"]),
79+
)

src/lib/badge/BUILD.bazel

+5
Original file line numberDiff line numberDiff line change
@@ -45,3 +45,8 @@ markdown_to_html(
4545
name = "overview",
4646
srcs = [":badge.md"],
4747
)
48+
49+
filegroup(
50+
name = "source-files",
51+
srcs = glob(["**/*.ts"]),
52+
)

src/lib/bottom-sheet/BUILD.bazel

+5
Original file line numberDiff line numberDiff line change
@@ -64,3 +64,8 @@ markdown_to_html(
6464
name = "overview",
6565
srcs = [":bottom-sheet.md"],
6666
)
67+
68+
filegroup(
69+
name = "source-files",
70+
srcs = glob(["**/*.ts"]),
71+
)

src/lib/button-toggle/BUILD.bazel

+5
Original file line numberDiff line numberDiff line change
@@ -54,3 +54,8 @@ markdown_to_html(
5454
name = "overview",
5555
srcs = [":button-toggle.md"],
5656
)
57+
58+
filegroup(
59+
name = "source-files",
60+
srcs = glob(["**/*.ts"]),
61+
)

src/lib/button/BUILD.bazel

+5
Original file line numberDiff line numberDiff line change
@@ -54,3 +54,8 @@ markdown_to_html(
5454
name = "overview",
5555
srcs = [":button.md"],
5656
)
57+
58+
filegroup(
59+
name = "source-files",
60+
srcs = glob(["**/*.ts"]),
61+
)

src/lib/card/BUILD.bazel

+5
Original file line numberDiff line numberDiff line change
@@ -33,3 +33,8 @@ markdown_to_html(
3333
name = "overview",
3434
srcs = [":card.md"],
3535
)
36+
37+
filegroup(
38+
name = "source-files",
39+
srcs = glob(["**/*.ts"]),
40+
)

src/lib/checkbox/BUILD.bazel

+5
Original file line numberDiff line numberDiff line change
@@ -60,3 +60,8 @@ markdown_to_html(
6060
name = "overview",
6161
srcs = [":checkbox.md"],
6262
)
63+
64+
filegroup(
65+
name = "source-files",
66+
srcs = glob(["**/*.ts"]),
67+
)

src/lib/chips/BUILD.bazel

+5
Original file line numberDiff line numberDiff line change
@@ -69,3 +69,8 @@ markdown_to_html(
6969
name = "overview",
7070
srcs = [":chips.md"],
7171
)
72+
73+
filegroup(
74+
name = "source-files",
75+
srcs = glob(["**/*.ts"]),
76+
)

src/lib/core/BUILD.bazel

+5
Original file line numberDiff line numberDiff line change
@@ -120,3 +120,8 @@ markdown_to_html(
120120
name = "overview",
121121
srcs = ["ripple/ripple.md"],
122122
)
123+
124+
filegroup(
125+
name = "source-files",
126+
srcs = glob(["**/*.ts"]),
127+
)

src/lib/datepicker/BUILD.bazel

+5
Original file line numberDiff line numberDiff line change
@@ -94,3 +94,8 @@ markdown_to_html(
9494
name = "overview",
9595
srcs = [":datepicker.md"],
9696
)
97+
98+
filegroup(
99+
name = "source-files",
100+
srcs = glob(["**/*.ts"]),
101+
)

src/lib/dialog/BUILD.bazel

+5
Original file line numberDiff line numberDiff line change
@@ -66,3 +66,8 @@ markdown_to_html(
6666
name = "overview",
6767
srcs = [":dialog.md"],
6868
)
69+
70+
filegroup(
71+
name = "source-files",
72+
srcs = glob(["**/*.ts"]),
73+
)

src/lib/divider/BUILD.bazel

+5
Original file line numberDiff line numberDiff line change
@@ -46,3 +46,8 @@ markdown_to_html(
4646
name = "overview",
4747
srcs = [":divider.md"],
4848
)
49+
50+
filegroup(
51+
name = "source-files",
52+
srcs = glob(["**/*.ts"]),
53+
)

src/lib/expansion/BUILD.bazel

+5
Original file line numberDiff line numberDiff line change
@@ -70,3 +70,8 @@ markdown_to_html(
7070
name = "overview",
7171
srcs = [":expansion.md"],
7272
)
73+
74+
filegroup(
75+
name = "source-files",
76+
srcs = glob(["**/*.ts"]),
77+
)

src/lib/form-field/BUILD.bazel

+5
Original file line numberDiff line numberDiff line change
@@ -89,3 +89,8 @@ markdown_to_html(
8989
name = "overview",
9090
srcs = [":form-field.md"],
9191
)
92+
93+
filegroup(
94+
name = "source-files",
95+
srcs = glob(["**/*.ts"]),
96+
)

src/lib/grid-list/BUILD.bazel

+5
Original file line numberDiff line numberDiff line change
@@ -48,3 +48,8 @@ markdown_to_html(
4848
name = "overview",
4949
srcs = [":grid-list.md"],
5050
)
51+
52+
filegroup(
53+
name = "source-files",
54+
srcs = glob(["**/*.ts"]),
55+
)

src/lib/icon/BUILD.bazel

+5
Original file line numberDiff line numberDiff line change
@@ -53,3 +53,8 @@ markdown_to_html(
5353
name = "overview",
5454
srcs = [":icon.md"],
5555
)
56+
57+
filegroup(
58+
name = "source-files",
59+
srcs = glob(["**/*.ts"]),
60+
)

src/lib/input/BUILD.bazel

+5
Original file line numberDiff line numberDiff line change
@@ -56,3 +56,8 @@ markdown_to_html(
5656
name = "overview",
5757
srcs = [":input.md"],
5858
)
59+
60+
filegroup(
61+
name = "source-files",
62+
srcs = glob(["**/*.ts"]),
63+
)

src/lib/list/BUILD.bazel

+5
Original file line numberDiff line numberDiff line change
@@ -60,3 +60,8 @@ markdown_to_html(
6060
name = "overview",
6161
srcs = [":list.md"],
6262
)
63+
64+
filegroup(
65+
name = "source-files",
66+
srcs = glob(["**/*.ts"]),
67+
)

src/lib/menu/BUILD.bazel

+5
Original file line numberDiff line numberDiff line change
@@ -68,3 +68,8 @@ markdown_to_html(
6868
name = "overview",
6969
srcs = [":menu.md"],
7070
)
71+
72+
filegroup(
73+
name = "source-files",
74+
srcs = glob(["**/*.ts"]),
75+
)

src/lib/paginator/BUILD.bazel

+5
Original file line numberDiff line numberDiff line change
@@ -54,3 +54,8 @@ markdown_to_html(
5454
name = "overview",
5555
srcs = [":paginator.md"],
5656
)
57+
58+
filegroup(
59+
name = "source-files",
60+
srcs = glob(["**/*.ts"]),
61+
)

src/lib/progress-bar/BUILD.bazel

+5
Original file line numberDiff line numberDiff line change
@@ -54,3 +54,8 @@ markdown_to_html(
5454
name = "overview",
5555
srcs = [":progress-bar.md"],
5656
)
57+
58+
filegroup(
59+
name = "source-files",
60+
srcs = glob(["**/*.ts"]),
61+
)

src/lib/progress-spinner/BUILD.bazel

+5
Original file line numberDiff line numberDiff line change
@@ -49,3 +49,8 @@ markdown_to_html(
4949
name = "overview",
5050
srcs = [":progress-spinner.md"],
5151
)
52+
53+
filegroup(
54+
name = "source-files",
55+
srcs = glob(["**/*.ts"]),
56+
)

src/lib/radio/BUILD.bazel

+5
Original file line numberDiff line numberDiff line change
@@ -56,3 +56,8 @@ markdown_to_html(
5656
name = "overview",
5757
srcs = [":radio.md"],
5858
)
59+
60+
filegroup(
61+
name = "source-files",
62+
srcs = glob(["**/*.ts"]),
63+
)

src/lib/select/BUILD.bazel

+5
Original file line numberDiff line numberDiff line change
@@ -74,3 +74,8 @@ markdown_to_html(
7474
name = "overview",
7575
srcs = [":select.md"],
7676
)
77+
78+
filegroup(
79+
name = "source-files",
80+
srcs = glob(["**/*.ts"]),
81+
)

src/lib/sidenav/BUILD.bazel

+5
Original file line numberDiff line numberDiff line change
@@ -66,3 +66,8 @@ markdown_to_html(
6666
name = "overview",
6767
srcs = [":sidenav.md"],
6868
)
69+
70+
filegroup(
71+
name = "source-files",
72+
srcs = glob(["**/*.ts"]),
73+
)

src/lib/slide-toggle/BUILD.bazel

+5
Original file line numberDiff line numberDiff line change
@@ -61,3 +61,8 @@ markdown_to_html(
6161
name = "overview",
6262
srcs = [":slide-toggle.md"],
6363
)
64+
65+
filegroup(
66+
name = "source-files",
67+
srcs = glob(["**/*.ts"]),
68+
)

src/lib/slider/BUILD.bazel

+5
Original file line numberDiff line numberDiff line change
@@ -62,3 +62,8 @@ markdown_to_html(
6262
name = "overview",
6363
srcs = [":slider.md"],
6464
)
65+
66+
filegroup(
67+
name = "source-files",
68+
srcs = glob(["**/*.ts"]),
69+
)

src/lib/snack-bar/BUILD.bazel

+5
Original file line numberDiff line numberDiff line change
@@ -67,3 +67,8 @@ markdown_to_html(
6767
name = "overview",
6868
srcs = [":snack-bar.md"],
6969
)
70+
71+
filegroup(
72+
name = "source-files",
73+
srcs = glob(["**/*.ts"]),
74+
)

src/lib/sort/BUILD.bazel

+5
Original file line numberDiff line numberDiff line change
@@ -55,3 +55,8 @@ markdown_to_html(
5555
name = "overview",
5656
srcs = [":sort.md"],
5757
)
58+
59+
filegroup(
60+
name = "source-files",
61+
srcs = glob(["**/*.ts"]),
62+
)

src/lib/stepper/BUILD.bazel

+5
Original file line numberDiff line numberDiff line change
@@ -75,3 +75,8 @@ markdown_to_html(
7575
name = "overview",
7676
srcs = [":stepper.md"],
7777
)
78+
79+
filegroup(
80+
name = "source-files",
81+
srcs = glob(["**/*.ts"]),
82+
)

src/lib/table/BUILD.bazel

+5
Original file line numberDiff line numberDiff line change
@@ -55,3 +55,8 @@ markdown_to_html(
5555
name = "overview",
5656
srcs = [":table.md"],
5757
)
58+
59+
filegroup(
60+
name = "source-files",
61+
srcs = glob(["**/*.ts"]),
62+
)

src/lib/tabs/BUILD.bazel

+5
Original file line numberDiff line numberDiff line change
@@ -102,3 +102,8 @@ markdown_to_html(
102102
name = "overview",
103103
srcs = [":tabs.md"],
104104
)
105+
106+
filegroup(
107+
name = "source-files",
108+
srcs = glob(["**/*.ts"]),
109+
)

src/lib/toolbar/BUILD.bazel

+5
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,11 @@ markdown_to_html(
5151
srcs = [":toolbar.md"],
5252
)
5353

54+
filegroup(
55+
name = "source-files",
56+
srcs = glob(["**/*.ts"]),
57+
)
58+
5459

5560

5661

src/lib/tooltip/BUILD.bazel

+5
Original file line numberDiff line numberDiff line change
@@ -70,3 +70,8 @@ markdown_to_html(
7070
name = "overview",
7171
srcs = [":tooltip.md"],
7272
)
73+
74+
filegroup(
75+
name = "source-files",
76+
srcs = glob(["**/*.ts"]),
77+
)

src/lib/tree/BUILD.bazel

+5
Original file line numberDiff line numberDiff line change
@@ -50,3 +50,8 @@ markdown_to_html(
5050
name = "overview",
5151
srcs = [":tree.md"],
5252
)
53+
54+
filegroup(
55+
name = "source-files",
56+
srcs = glob(["**/*.ts"]),
57+
)

src/material-examples/BUILD.bazel

+2-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,8 @@ package_docs_content(
5151
"//src/lib:overviews": "overviews/material",
5252
"//src/cdk:overviews": "overviews/cdk",
5353

54-
# TODO(devversion): we need to also package the API html files here
54+
# Package the API docs for the Material and CDK package into the docs-content
55+
"//src:api-docs": "api-docs",
5556
}
5657
)
5758

tools/dgeni/bazel-bin.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,9 @@ if (require.main === module) {
6767
// inherited class members across entry points or packages.
6868
entryPoints.forEach(entryPointName => {
6969
const entryPointPath = `${packageName}/${entryPointName}`;
70-
const entryPointIndexPath = `${entryPointPath}/index.ts`;
70+
// For the entry point path we temporarily want to replace "material" with "lib", as
71+
// our package source folder does not align with the entry-point name.
72+
const entryPointIndexPath = `${entryPointPath.replace('material', 'lib')}/index.ts`;
7173

7274
tsParser.options.paths![`@angular/${entryPointPath}`] = [entryPointIndexPath];
7375
readTypeScriptModules.sourceFiles.push(entryPointIndexPath);

0 commit comments

Comments
 (0)