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

61 lines
1.5 KiB
Python
Raw Normal View History

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",
"@ngdeps//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",
"safety-worker.js",
"//packages/service-worker/config:package.json",
],
data = [
":ngsw_config_binary",
":ngsw_worker_renamed",
"//packages/service-worker/config",
],
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",
],
)