angular-docs-cn/packages/service-worker/BUILD.bazel

62 lines
1.6 KiB
Python

load("//tools:defaults.bzl", "ng_module", "ng_package")
package(default_visibility = ["//visibility:public"])
ng_module(
name = "service-worker",
srcs = glob(
[
"*.ts",
"src/**/*.ts",
],
),
bundle_dts = True,
deps = [
"//packages/common",
"//packages/core",
"@npm//rxjs",
],
)
genrule(
name = "ngsw_config_binary",
srcs = ["//packages/service-worker/cli:ngsw_config.js"],
outs = ["ngsw-config.js"],
cmd = "echo '#!/usr/bin/env node' > $@ && cat $< >> $@",
)
genrule(
name = "ngsw_worker_renamed",
srcs = ["//packages/service-worker/worker:ngsw_worker.es6.js"],
outs = ["ngsw-worker.js"],
# Remove sourcemap since this file will be served in production site
# See https://github.com/angular/angular/issues/23596
cmd = "grep -v '//# sourceMappingURL' < $< > $@",
)
ng_package(
name = "npm_package",
srcs = [
"package.json",
"//packages/service-worker/config:package.json",
],
data = [
"safety-worker.js",
":ngsw_config_binary",
":ngsw_worker_renamed",
"//packages/service-worker/config",
"//packages/service-worker/config:schema.json",
],
entry_point = "packages/service-worker/index.js",
tags = [
"release-with-framework",
],
# Do not add more to this list.
# Dependencies on the full npm_package cause long re-builds.
visibility = ["//visibility:private"],
deps = [
":service-worker",
"//packages/service-worker/config",
],
)