diff --git a/packages/service-worker/BUILD.bazel b/packages/service-worker/BUILD.bazel index 01c2855891..5777b67bf0 100644 --- a/packages/service-worker/BUILD.bazel +++ b/packages/service-worker/BUILD.bazel @@ -19,16 +19,35 @@ ng_module( ], ) +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"], + cmd = "cp $< $@", +) + 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 = [ - # TODO(alxhub): enable release after landing #23090 - # "release-with-framework", + "release-with-framework", ], deps = [ ":service-worker", diff --git a/packages/service-worker/cli/BUILD.bazel b/packages/service-worker/cli/BUILD.bazel new file mode 100644 index 0000000000..59cebe49a7 --- /dev/null +++ b/packages/service-worker/cli/BUILD.bazel @@ -0,0 +1,25 @@ +package(default_visibility = ["//visibility:public"]) + +load("//tools:defaults.bzl", "ts_library", "npm_package") +load("//packages/bazel/src:ng_rollup_bundle.bzl", "ng_rollup_bundle") + +ts_library( + name = "cli", + srcs = glob( + [ + "*.ts", + ], + ), + tsconfig = ":tsconfig.json", + deps = [ + "//packages/service-worker/config", + ], +) + +ng_rollup_bundle( + name = "ngsw_config", + entry_point = "packages/service-worker/cli/main.js", + deps = [ + ":cli", + ], +) diff --git a/packages/service-worker/worker/BUILD.bazel b/packages/service-worker/worker/BUILD.bazel index 7f95c0440c..121809e63a 100644 --- a/packages/service-worker/worker/BUILD.bazel +++ b/packages/service-worker/worker/BUILD.bazel @@ -1,6 +1,7 @@ package(default_visibility = ["//visibility:public"]) load("@build_bazel_rules_typescript//:defs.bzl", "ts_library") +load("//packages/bazel/src:ng_rollup_bundle.bzl", "ng_rollup_bundle") ts_library( name = "worker", @@ -17,5 +18,14 @@ ts_library( ts_library( name = "main", srcs = ["main.ts"], + tsconfig = ":tsconfig.json", deps = [":worker"], ) + +ng_rollup_bundle( + name = "ngsw_worker", + entry_point = "packages/service-worker/worker/main.js", + deps = [ + ":main", + ], +) diff --git a/scripts/release/publish-next b/scripts/release/publish-next index 61f299a0ac..aa1d0f53ec 100755 --- a/scripts/release/publish-next +++ b/scripts/release/publish-next @@ -3,11 +3,11 @@ set -u -e -o pipefail # Use for BETA and RC releases -# Publish all packages in `dist/packages-dist` to npm (as next) - # Query Bazel for npm_package and ng_package rules with tags=["release-with-framework"] +# Publish them to npm (tagged next) for p in $(bazel query --output=label 'attr("tags", "\[.*release-with-framework.*\]", //...) intersect kind(".*_package", //...) except //dist/...'); do bazel run -- $p.publish --access public --tag next done -(cd dist/packages-dist; for p in language-service service-worker; do npm publish --access public --tag next $p; done) +# TODO(alexeagle): publish everything from bazel and remove this +(cd dist/packages-dist; for p in language-service; do npm publish --access public --tag next $p; done)