angular/aio/scripts/BUILD.bazel
Joey Perrott ade024407d fix(docs-infra): remove part aio infra (#54929)
Remove parts of the aio infra

PR Close #54929
2024-04-02 18:38:04 +00:00

97 lines
2.4 KiB
Text

load("@build_bazel_rules_nodejs//:index.bzl", "js_library")
load("@npm//@angular/build-tooling/bazel:filter_outputs.bzl", "filter_first_output")
load("//tools:defaults.bzl", "nodejs_binary", "nodejs_test")
package(default_visibility = ["//visibility:public"])
exports_files([
"run-with-local-server.mjs",
])
nodejs_binary(
name = "build-ngsw-config",
data = [
"//aio:firebase.json",
"//aio:ngsw-config.template.json",
"@npm//canonical-path",
"@npm//json5",
],
entry_point = "build-ngsw-config.js",
)
js_library(
name = "fast-serve-and-watch",
srcs = [
"fast-serve-and-watch.mjs",
],
deps = [
"//aio/tools/transforms/authors-package:watchdocs",
"@npm//@angular-devkit/architect-cli",
],
)
nodejs_binary(
name = "build-404-page",
entry_point = "build-404-page.js",
)
nodejs_binary(
name = "audit-web-app",
testonly = True,
data = [
"//aio/tools:windows-chromium-path",
"@npm//@angular/build-tooling/bazel/browsers/chromium",
"@npm//lighthouse",
"@npm//lighthouse-logger",
"@npm//puppeteer-core",
],
entry_point = "audit-web-app.mjs",
env = {
"CHROME_BIN": "$(CHROMIUM)",
},
toolchains = [
"@npm//@angular/build-tooling/bazel/browsers/chromium:toolchain_alias",
],
)
# Extract the executable audit script from DefaultInfo so that we can use
# $(rootpath) on it.
filter_first_output(
name = "audit-web-app-script",
testonly = True,
filters = [
# On Windows select the batch script
"audit-web-app.bat",
"audit-web-app.sh",
],
target = ":audit-web-app",
)
# This should be a nodejs_binary, however calling "bazel run" on this target
# on OSX causes the runfiles build to fail due to bazel-provided chromium having
# files with spaces in the name. However, it works when run in the sandbox when
# called using "bazel test".
#
# On Windows/Linux, call with:
#
# bazel run //aio/scripts:test-aio-a11y [targetUrl]
#
# On OXS call with:
#
# bazel test //aio/scripts:test-aio-a11y --test_arg=[targetUrl]
nodejs_test(
name = "test-aio-a11y",
testonly = True,
data = [
":audit-web-app",
":audit-web-app-script",
"@npm//shelljs",
],
entry_point = "test-aio-a11y.mjs",
env = {
"AUDIT_SCRIPT_PATH": "$(rootpath :audit-web-app-script)",
},
tags = [
"manual",
],
)