Skip to content

Commit

Permalink
build: package material api docs into npm package (#14508)
Browse files Browse the repository at this point in the history
  • Loading branch information
devversion authored and jelbourn committed Dec 21, 2018
1 parent 9914970 commit d22f48c
Show file tree
Hide file tree
Showing 39 changed files with 208 additions and 10 deletions.
9 changes: 7 additions & 2 deletions src/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
package(default_visibility = ["//visibility:public"])

load("//:packages.bzl", "CDK_PACKAGES")
load("//:packages.bzl", "CDK_PACKAGES", "MATERIAL_PACKAGES")
load("//tools:defaults.bzl", "ts_library")
load("//tools/dgeni:index.bzl", "dgeni_api_docs")

# List that contains all source files that need to be processed by Dgeni.
apiSourceFiles = ["//src/cdk/%s:source-files" % name for name in CDK_PACKAGES] + [
"//src/lib/%s:source-files" % name for name in MATERIAL_PACKAGES]

exports_files([
"bazel-tsconfig-build.json",
"bazel-tsconfig-test.json",
Expand All @@ -17,13 +21,14 @@ ts_library(

dgeni_api_docs(
name = "api-docs",
srcs = ["//src/cdk/%s:source-files" % name for name in CDK_PACKAGES] + [
srcs = apiSourceFiles + [
# Add all Angular packages to the sources because some Material exports use
# Angular exports and these should not cause any warnings when Dgeni uses the
# type checker to parse our TypeScript sources.
"@matdeps//@angular"
],
entry_points = {
"cdk": CDK_PACKAGES,
"material": MATERIAL_PACKAGES,
},
)
5 changes: 5 additions & 0 deletions src/lib/autocomplete/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -72,3 +72,8 @@ markdown_to_html(
name = "overview",
srcs = [":autocomplete.md"],
)

filegroup(
name = "source-files",
srcs = glob(["**/*.ts"]),
)
5 changes: 5 additions & 0 deletions src/lib/badge/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -45,3 +45,8 @@ markdown_to_html(
name = "overview",
srcs = [":badge.md"],
)

filegroup(
name = "source-files",
srcs = glob(["**/*.ts"]),
)
5 changes: 5 additions & 0 deletions src/lib/bottom-sheet/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -64,3 +64,8 @@ markdown_to_html(
name = "overview",
srcs = [":bottom-sheet.md"],
)

filegroup(
name = "source-files",
srcs = glob(["**/*.ts"]),
)
5 changes: 5 additions & 0 deletions src/lib/button-toggle/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -54,3 +54,8 @@ markdown_to_html(
name = "overview",
srcs = [":button-toggle.md"],
)

filegroup(
name = "source-files",
srcs = glob(["**/*.ts"]),
)
5 changes: 5 additions & 0 deletions src/lib/button/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -54,3 +54,8 @@ markdown_to_html(
name = "overview",
srcs = [":button.md"],
)

filegroup(
name = "source-files",
srcs = glob(["**/*.ts"]),
)
5 changes: 5 additions & 0 deletions src/lib/card/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,8 @@ markdown_to_html(
name = "overview",
srcs = [":card.md"],
)

filegroup(
name = "source-files",
srcs = glob(["**/*.ts"]),
)
5 changes: 5 additions & 0 deletions src/lib/checkbox/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -60,3 +60,8 @@ markdown_to_html(
name = "overview",
srcs = [":checkbox.md"],
)

filegroup(
name = "source-files",
srcs = glob(["**/*.ts"]),
)
5 changes: 5 additions & 0 deletions src/lib/chips/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -69,3 +69,8 @@ markdown_to_html(
name = "overview",
srcs = [":chips.md"],
)

filegroup(
name = "source-files",
srcs = glob(["**/*.ts"]),
)
5 changes: 5 additions & 0 deletions src/lib/core/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -120,3 +120,8 @@ markdown_to_html(
name = "overview",
srcs = ["ripple/ripple.md"],
)

filegroup(
name = "source-files",
srcs = glob(["**/*.ts"]),
)
5 changes: 5 additions & 0 deletions src/lib/datepicker/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -94,3 +94,8 @@ markdown_to_html(
name = "overview",
srcs = [":datepicker.md"],
)

filegroup(
name = "source-files",
srcs = glob(["**/*.ts"]),
)
5 changes: 5 additions & 0 deletions src/lib/dialog/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -66,3 +66,8 @@ markdown_to_html(
name = "overview",
srcs = [":dialog.md"],
)

filegroup(
name = "source-files",
srcs = glob(["**/*.ts"]),
)
5 changes: 5 additions & 0 deletions src/lib/divider/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,8 @@ markdown_to_html(
name = "overview",
srcs = [":divider.md"],
)

filegroup(
name = "source-files",
srcs = glob(["**/*.ts"]),
)
5 changes: 5 additions & 0 deletions src/lib/expansion/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -70,3 +70,8 @@ markdown_to_html(
name = "overview",
srcs = [":expansion.md"],
)

filegroup(
name = "source-files",
srcs = glob(["**/*.ts"]),
)
5 changes: 5 additions & 0 deletions src/lib/form-field/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -89,3 +89,8 @@ markdown_to_html(
name = "overview",
srcs = [":form-field.md"],
)

filegroup(
name = "source-files",
srcs = glob(["**/*.ts"]),
)
5 changes: 5 additions & 0 deletions src/lib/grid-list/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -48,3 +48,8 @@ markdown_to_html(
name = "overview",
srcs = [":grid-list.md"],
)

filegroup(
name = "source-files",
srcs = glob(["**/*.ts"]),
)
5 changes: 5 additions & 0 deletions src/lib/icon/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -53,3 +53,8 @@ markdown_to_html(
name = "overview",
srcs = [":icon.md"],
)

filegroup(
name = "source-files",
srcs = glob(["**/*.ts"]),
)
5 changes: 5 additions & 0 deletions src/lib/input/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -56,3 +56,8 @@ markdown_to_html(
name = "overview",
srcs = [":input.md"],
)

filegroup(
name = "source-files",
srcs = glob(["**/*.ts"]),
)
5 changes: 5 additions & 0 deletions src/lib/list/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -60,3 +60,8 @@ markdown_to_html(
name = "overview",
srcs = [":list.md"],
)

filegroup(
name = "source-files",
srcs = glob(["**/*.ts"]),
)
5 changes: 5 additions & 0 deletions src/lib/menu/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -68,3 +68,8 @@ markdown_to_html(
name = "overview",
srcs = [":menu.md"],
)

filegroup(
name = "source-files",
srcs = glob(["**/*.ts"]),
)
5 changes: 5 additions & 0 deletions src/lib/paginator/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -54,3 +54,8 @@ markdown_to_html(
name = "overview",
srcs = [":paginator.md"],
)

filegroup(
name = "source-files",
srcs = glob(["**/*.ts"]),
)
5 changes: 5 additions & 0 deletions src/lib/progress-bar/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -54,3 +54,8 @@ markdown_to_html(
name = "overview",
srcs = [":progress-bar.md"],
)

filegroup(
name = "source-files",
srcs = glob(["**/*.ts"]),
)
5 changes: 5 additions & 0 deletions src/lib/progress-spinner/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -49,3 +49,8 @@ markdown_to_html(
name = "overview",
srcs = [":progress-spinner.md"],
)

filegroup(
name = "source-files",
srcs = glob(["**/*.ts"]),
)
5 changes: 5 additions & 0 deletions src/lib/radio/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -56,3 +56,8 @@ markdown_to_html(
name = "overview",
srcs = [":radio.md"],
)

filegroup(
name = "source-files",
srcs = glob(["**/*.ts"]),
)
5 changes: 5 additions & 0 deletions src/lib/select/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -74,3 +74,8 @@ markdown_to_html(
name = "overview",
srcs = [":select.md"],
)

filegroup(
name = "source-files",
srcs = glob(["**/*.ts"]),
)
5 changes: 5 additions & 0 deletions src/lib/sidenav/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -66,3 +66,8 @@ markdown_to_html(
name = "overview",
srcs = [":sidenav.md"],
)

filegroup(
name = "source-files",
srcs = glob(["**/*.ts"]),
)
5 changes: 5 additions & 0 deletions src/lib/slide-toggle/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -61,3 +61,8 @@ markdown_to_html(
name = "overview",
srcs = [":slide-toggle.md"],
)

filegroup(
name = "source-files",
srcs = glob(["**/*.ts"]),
)
5 changes: 5 additions & 0 deletions src/lib/slider/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -62,3 +62,8 @@ markdown_to_html(
name = "overview",
srcs = [":slider.md"],
)

filegroup(
name = "source-files",
srcs = glob(["**/*.ts"]),
)
5 changes: 5 additions & 0 deletions src/lib/snack-bar/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -67,3 +67,8 @@ markdown_to_html(
name = "overview",
srcs = [":snack-bar.md"],
)

filegroup(
name = "source-files",
srcs = glob(["**/*.ts"]),
)
5 changes: 5 additions & 0 deletions src/lib/sort/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -55,3 +55,8 @@ markdown_to_html(
name = "overview",
srcs = [":sort.md"],
)

filegroup(
name = "source-files",
srcs = glob(["**/*.ts"]),
)
5 changes: 5 additions & 0 deletions src/lib/stepper/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -75,3 +75,8 @@ markdown_to_html(
name = "overview",
srcs = [":stepper.md"],
)

filegroup(
name = "source-files",
srcs = glob(["**/*.ts"]),
)
5 changes: 5 additions & 0 deletions src/lib/table/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -55,3 +55,8 @@ markdown_to_html(
name = "overview",
srcs = [":table.md"],
)

filegroup(
name = "source-files",
srcs = glob(["**/*.ts"]),
)
5 changes: 5 additions & 0 deletions src/lib/tabs/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -102,3 +102,8 @@ markdown_to_html(
name = "overview",
srcs = [":tabs.md"],
)

filegroup(
name = "source-files",
srcs = glob(["**/*.ts"]),
)
5 changes: 5 additions & 0 deletions src/lib/toolbar/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,11 @@ markdown_to_html(
srcs = [":toolbar.md"],
)

filegroup(
name = "source-files",
srcs = glob(["**/*.ts"]),
)




5 changes: 5 additions & 0 deletions src/lib/tooltip/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -70,3 +70,8 @@ markdown_to_html(
name = "overview",
srcs = [":tooltip.md"],
)

filegroup(
name = "source-files",
srcs = glob(["**/*.ts"]),
)
5 changes: 5 additions & 0 deletions src/lib/tree/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -50,3 +50,8 @@ markdown_to_html(
name = "overview",
srcs = [":tree.md"],
)

filegroup(
name = "source-files",
srcs = glob(["**/*.ts"]),
)
3 changes: 2 additions & 1 deletion src/material-examples/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@ package_docs_content(
"//src/lib:overviews": "overviews/material",
"//src/cdk:overviews": "overviews/cdk",

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

Expand Down
4 changes: 3 additions & 1 deletion tools/dgeni/bazel-bin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,9 @@ if (require.main === module) {
// inherited class members across entry points or packages.
entryPoints.forEach(entryPointName => {
const entryPointPath = `${packageName}/${entryPointName}`;
const entryPointIndexPath = `${entryPointPath}/index.ts`;
// For the entry point path we temporarily want to replace "material" with "lib", as
// our package source folder does not align with the entry-point name.
const entryPointIndexPath = `${entryPointPath.replace('material', 'lib')}/index.ts`;

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

0 comments on commit d22f48c

Please sign in to comment.