mirror of
https://github.com/angular/angular.git
synced 2026-09-14 13:54:52 +08:00
fcc000e803
This adds `generate_api_docs` targets to all of the packages for which we publish api reference docs. One known issue here is that any type information that comes from another package (e.g. router depending on core) currently resolve to `any` because the other sources are not available in the program. This can be tackled in a follow-up commit. This commit also updates the install patch for `@angular/build-tools` to use the local version of compiler-cli. PR Close #52034
89 lines
2.7 KiB
Python
89 lines
2.7 KiB
Python
load("//tools:defaults.bzl", "api_golden_test_npm_package", "ng_package", "ts_library")
|
|
load("//packages/bazel:index.bzl", "types_bundle")
|
|
load("@npm//@angular/build-tooling/bazel/api-gen:generate_api_docs.bzl", "generate_api_docs")
|
|
|
|
package(default_visibility = ["//visibility:public"])
|
|
|
|
ts_library(
|
|
name = "localize",
|
|
srcs = glob(
|
|
[
|
|
"*.ts",
|
|
"src/**/*.ts",
|
|
],
|
|
),
|
|
module_name = "@angular/localize",
|
|
deps = [
|
|
"//packages/localize/src/localize",
|
|
"//packages/localize/src/utils",
|
|
],
|
|
)
|
|
|
|
types_bundle(
|
|
name = "api_type_definitions",
|
|
entry_point = "localize.d.ts",
|
|
output_name = "localize/index.d.ts",
|
|
deps = [":localize"],
|
|
)
|
|
|
|
ng_package(
|
|
name = "npm_package",
|
|
package_name = "@angular/localize",
|
|
srcs = [
|
|
"package.json",
|
|
":api_type_definitions",
|
|
],
|
|
nested_packages = [
|
|
"//packages/localize/schematics:npm_package",
|
|
"//packages/localize/tools:npm_package",
|
|
],
|
|
skip_type_bundling = [
|
|
# For the primary entry-point we disable automatic type bundling because API extractor
|
|
# does not properly handle module augmentation.
|
|
# To workaround this issue, type bundling is done as a separate step for all types
|
|
# except the main `index.d.ts` file which contains the module augmentation. The main
|
|
# file is reference in the package.json and also imports the bundle types. The bundled
|
|
# types are created via `api_type_definitions` above.
|
|
# TODO: Remove once https://github.com/microsoft/rushstack/issues/2090 is solved.
|
|
"",
|
|
],
|
|
tags = [
|
|
"release-with-framework",
|
|
],
|
|
deps = [
|
|
":localize",
|
|
"//packages/localize/init",
|
|
],
|
|
)
|
|
|
|
api_golden_test_npm_package(
|
|
name = "localize_api",
|
|
data = [
|
|
":npm_package",
|
|
"//goldens:public-api",
|
|
],
|
|
golden_dir = "angular/goldens/public-api/localize",
|
|
npm_package = "angular/packages/localize/npm_package",
|
|
# The logic for the localize function is exported in the primary entry-point, but users
|
|
# are not supposed to import it from there. We still want to guard these exports though.
|
|
strip_export_pattern = "^ɵ(?!.localize|LocalizeFn|TranslateFn)",
|
|
# The tool entry-point uses namespace aliases and API extractor needs to be
|
|
# able to resolve `@babel/core` to fully understand the `types` re-export/alias.
|
|
types = ["@npm//@types/babel__core"],
|
|
)
|
|
|
|
filegroup(
|
|
name = "files_for_docgen",
|
|
srcs = glob([
|
|
"*.ts",
|
|
"src/**/*.ts",
|
|
]) + ["PACKAGE.md"],
|
|
)
|
|
|
|
generate_api_docs(
|
|
name = "localize_docs",
|
|
srcs = [":files_for_docgen"],
|
|
entry_point = ":index.ts",
|
|
module_name = "@angular/localize",
|
|
)
|