/
githubmirror
/
components
Обзор
Документация
Войти
/
githubmirror
/
components
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
src/components-examples/BUILD.bazel
103 строки
3 KB
Kristiyan Kostadinov
docs: switch datepicker examples to Luxon (#32008)
08 окт 2025, 18:23
Не верифицирован
08 окт 2025, 18:23
f6e8a02
Код
Авторство
О чём код?
load("@npm//:defs.bzl", "npm_link_all_packages") load("//tools:defaults.bzl", "ng_package", "ng_project") load("//tools/highlight-files:index.bzl", "highlight_files") load("//tools/package-docs-content:index.bzl", "package_docs_content") load(":config.bzl", "ALL_EXAMPLES") package(default_visibility = ["//visibility:public"]) npm_link_all_packages() ng_project( name = "components-examples", srcs = glob( ["*.ts"], exclude = ["example-module.d.ts"], ) + [":example-module.ts"], deps = [ "//:node_modules/@angular/core", ] + ALL_EXAMPLES, ) filegroup( name = "example-source-files", srcs = ["%s:source-files" % pkg for pkg in ALL_EXAMPLES], ) highlight_files( name = "examples-highlighted", srcs = [":example-source-files"], ) package_docs_content( name = "docs-content", srcs = { # We want to package the guides in to the docs content. These will be displayed # in the documentation. "//guides": "guides", # Package the overviews for "@angular/material" and "@angular/cdk" into the docs content "//src/cdk:overviews": "overviews/cdk", "//src/material:overviews": "overviews/material", # Package the API docs for the Material and CDK package into the docs-content "//src:api-docs": "api-docs", # In order to be able to run examples in StackBlitz, we also want to package the # plain source files into the docs-content. ":example-source-files": "examples-source", # For the live-examples in our docs, we want to package the highlighted files # into the docs content. These will be used to show the source code for examples. # Note: `examples-highlighted` is a tree artifact that we want to store as is # in the docs-content. Hence there is no target section name. ":examples-highlighted": "", }, ) ng_package( name = "npm_package", package_name = "@angular/components-examples", srcs = ["package.json"], # this is a workaround to store a tree artifact in the ng_package. # ng_package does not properly handle tree artifacts currently so we escalate to nested_packages nested_packages = [":docs-content"], package_deps = [ ":node_modules/@angular/aria", ":node_modules/@angular/cdk", ":node_modules/@angular/cdk-experimental", ":node_modules/@angular/material", ":node_modules/@angular/material-experimental", ":node_modules/@angular/material-luxon-adapter", ], replace_prefixes = { "docs-content/": "/", }, tags = ["docs-package"], visibility = ["//:__pkg__"], deps = [":components-examples"] + ALL_EXAMPLES, ) genrule( name = "example-module", srcs = [":example-source-files"], outs = [ "example-module.ts", "_example_module.MF", ], cmd = """ # Create source file manifest echo "$(execpaths //src/components-examples:example-source-files)" \ > $(execpath _example_module.MF) export JS_BINARY__NO_CD_BINDIR="1" # Run the bazel entry-point for generating the example module. ./$(execpath //tools/example-module:bazel-bin) \ "$(execpath _example_module.MF)" \ "$(execpath example-module.ts)" \ "$$PWD/src/components-examples" """, output_to_bindir = True, tools = ["//tools/example-module:bazel-bin"], )