angular-cn/dev-infra/BUILD.bazel

89 lines
2.5 KiB
Python

load("@build_bazel_rules_nodejs//:index.bzl", "generated_file_test", "pkg_npm")
load("@npm//@bazel/typescript:index.bzl", "ts_library")
load("@npm//@bazel/rollup:index.bzl", "rollup_bundle")
ts_library(
name = "cli",
srcs = [
"cli.ts",
],
module_name = "@angular/dev-infra-private",
deps = [
"//dev-infra/caretaker",
"//dev-infra/commit-message",
"//dev-infra/format",
"//dev-infra/ngbot",
"//dev-infra/pr",
"//dev-infra/pullapprove",
"//dev-infra/release",
"//dev-infra/ts-circular-dependencies",
"//dev-infra/utils",
"@npm//@types/node",
"@npm//@types/yargs",
"@npm//yargs",
],
)
rollup_bundle(
name = "cli_rollup",
entry_point = ":cli.ts",
format = "cjs",
silent = True,
sourcemap = "false",
deps = [
":cli",
],
)
generated_file_test(
name = "local_ng_dev",
src = "ng-dev.js",
generated = "cli_rollup",
)
genrule(
name = "package-json",
srcs = [
"tmpl-package.json",
"//:package.json",
],
outs = ["package.json"],
cmd = """
$(execpath //tools:inline-package-json-deps) $(execpath tmpl-package.json) \
$(execpath //:package.json) $@
""",
tools = ["//tools:inline-package-json-deps"],
)
pkg_npm(
name = "npm_package",
srcs = [
"index.bzl",
"//dev-infra/bazel:files",
"//dev-infra/benchmark:files",
],
substitutions = {
# angular/angular should not consume it's own packages, so we use
# substitutions to replace these in the published version of dev-infra.
"//dev-infra/": "@npm_angular_dev_infra_private//",
"//packages/benchpress": "@npm//@angular/benchpress",
"//packages/bazel": "@npm//@angular/bazel",
"//packages/zone.js/bundles:zone.umd.js": "@npm//:node_modules/zone.js/dist/zone.js",
"//packages/core": "@npm//@angular/core",
"//packages/platform-browser": "@npm//@angular/platform-browser",
# This substitution is particularly verbose because we need to make sure
# that only things available via Angular Bazel are imported from
# tools/defaults.bzl.
"load\(\"//tools:defaults.bzl\", \"ng_module\"\)": "load(\"@npm//@angular/bazel:index.bzl\", \"ng_module\")",
},
visibility = ["//visibility:public"],
deps = [
":cli",
":package-json",
"//dev-infra/benchmark/driver-utilities",
"//dev-infra/commit-message",
"//dev-infra/ts-circular-dependencies",
],
)