build: remove html_insert_assets complication from integration/bazel (#34112)

For the purposes of the integration test the zone.js script & bundle script tags could just go into the source index.html itself. The purpose of the integration test is is to test @angular/bazel & ng_module & ng_package so there is no need to exercise html_insert_assets.

PR Close #34112
This commit is contained in:
Greg Magolan 2019-11-29 09:50:30 -08:00 committed by Kara Erickson
parent 7df2b4aeff
commit b0534177e0
4 changed files with 6 additions and 47 deletions

View File

@ -29,7 +29,6 @@
"@bazel/terser": "0.42.1", "@bazel/terser": "0.42.1",
"@bazel/typescript": "0.42.1", "@bazel/typescript": "0.42.1",
"@types/jasmine": "2.8.8", "@types/jasmine": "2.8.8",
"html-insert-assets": "0.2.0",
"http-server": "0.12.0", "http-server": "0.12.0",
"karma": "4.4.1", "karma": "4.4.1",
"karma-chrome-launcher": "3.1.0", "karma-chrome-launcher": "3.1.0",

View File

@ -1,7 +1,6 @@
package(default_visibility = ["//visibility:public"]) package(default_visibility = ["//visibility:public"])
load("@build_bazel_rules_nodejs//:index.bzl", "pkg_web") load("@build_bazel_rules_nodejs//:index.bzl", "pkg_web")
load("@npm//html-insert-assets:index.bzl", "html_insert_assets")
load("@npm//http-server:index.bzl", "http_server") load("@npm//http-server:index.bzl", "http_server")
load("@npm_angular_bazel//:index.bzl", "ng_module") load("@npm_angular_bazel//:index.bzl", "ng_module")
load("@npm_bazel_rollup//:index.bzl", "rollup_bundle") load("@npm_bazel_rollup//:index.bzl", "rollup_bundle")
@ -35,37 +34,9 @@ filegroup(
], ],
) )
html_insert_assets(
name = "inject_scripts",
# We can't output "index.html" since that collides with the input file.
# We output "_/index.html" instead and remap in ts_devserver & pkg_web
# using additional_root_paths.
outs = ["_/index.html"],
args = [
"--html",
"$(location :index.html)",
"--out",
"$@",
"--assets",
# We load zone.js outside the bundle. That's because it's a "polyfill"
# which speculates that such features might be available in a browser.
# Also it's tricky to configure dead code elimination to understand that
# zone.js is used, given that we don't have any import statement that
# imports from it.
"$(location @npm//:node_modules/zone.js/dist/zone.min.js)",
# Bundle path for both prodapp & devserver
"bundle.min.js",
],
data = [
":index.html",
"@npm//:node_modules/zone.js/dist/zone.min.js",
],
)
ts_devserver( ts_devserver(
name = "devserver", name = "devserver",
# Remap "_/index.html" => "index.html" additional_root_paths = ["npm/node_modules/zone.js/dist"],
additional_root_paths = ["src/_"],
entry_module = "bazel_integration_test/src/main", entry_module = "bazel_integration_test/src/main",
scripts = [ scripts = [
":rxjs_umd_modules", ":rxjs_umd_modules",
@ -74,7 +45,7 @@ ts_devserver(
# an index.html file. # an index.html file.
serving_path = "/bundle.min.js", serving_path = "/bundle.min.js",
static_files = [ static_files = [
":inject_scripts", "index.html",
"@npm//:node_modules/zone.js/dist/zone.min.js", "@npm//:node_modules/zone.js/dist/zone.min.js",
], ],
deps = ["//src"], deps = ["//src"],
@ -99,12 +70,11 @@ terser_minified(
pkg_web( pkg_web(
name = "prodapp", name = "prodapp",
srcs = [ srcs = [
"index.html",
":bundle.min", ":bundle.min",
":inject_scripts",
"@npm//:node_modules/zone.js/dist/zone.min.js", "@npm//:node_modules/zone.js/dist/zone.min.js",
], ],
# Remap "_/index.html" => "index.html" additional_root_paths = ["npm/node_modules/zone.js/dist"],
additional_root_paths = ["src/_"],
) )
http_server( http_server(

View File

@ -9,5 +9,7 @@
<body> <body>
<!-- The Angular application will be bootstrapped into this element. --> <!-- The Angular application will be bootstrapped into this element. -->
<app-component></app-component> <app-component></app-component>
<script src="/zone.min.js"></script>
<script src="/bundle.min.js"></script>
</body> </body>
</html> </html>

View File

@ -1524,13 +1524,6 @@ he@^1.1.1:
resolved "https://registry.yarnpkg.com/he/-/he-1.2.0.tgz#84ae65fa7eafb165fddb61566ae14baf05664f0f" resolved "https://registry.yarnpkg.com/he/-/he-1.2.0.tgz#84ae65fa7eafb165fddb61566ae14baf05664f0f"
integrity sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw== integrity sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw==
html-insert-assets@0.2.0:
version "0.2.0"
resolved "https://registry.yarnpkg.com/html-insert-assets/-/html-insert-assets-0.2.0.tgz#9b54223616aa85056dd637231e73029771c12d47"
integrity sha512-UsI4Bvczhk6kvQZXkSlAsy0R6jsdpVDpkmtpmO7NfYMaJ9N06u/AnsQOwL14uujEy3iVdW9w0UvAz/VMNZYAWw==
dependencies:
parse5 "^5.1.1"
http-errors@1.7.2: http-errors@1.7.2:
version "1.7.2" version "1.7.2"
resolved "https://registry.yarnpkg.com/http-errors/-/http-errors-1.7.2.tgz#4f5029cf13239f31036e5b2e55292bcfbcc85c8f" resolved "https://registry.yarnpkg.com/http-errors/-/http-errors-1.7.2.tgz#4f5029cf13239f31036e5b2e55292bcfbcc85c8f"
@ -2522,11 +2515,6 @@ parse5@^5.0.0:
resolved "https://registry.yarnpkg.com/parse5/-/parse5-5.1.0.tgz#c59341c9723f414c452975564c7c00a68d58acd2" resolved "https://registry.yarnpkg.com/parse5/-/parse5-5.1.0.tgz#c59341c9723f414c452975564c7c00a68d58acd2"
integrity sha512-fxNG2sQjHvlVAYmzBZS9YlDp6PTSSDwa98vkD4QgVDDCAo84z5X1t5XyJQ62ImdLXx5NdIIfihey6xpum9/gRQ== integrity sha512-fxNG2sQjHvlVAYmzBZS9YlDp6PTSSDwa98vkD4QgVDDCAo84z5X1t5XyJQ62ImdLXx5NdIIfihey6xpum9/gRQ==
parse5@^5.1.1:
version "5.1.1"
resolved "https://registry.yarnpkg.com/parse5/-/parse5-5.1.1.tgz#f68e4e5ba1852ac2cadc00f4555fff6c2abb6178"
integrity sha512-ugq4DFI0Ptb+WWjAdOK16+u/nHfiIrcE+sh8kZMaM0WllQKLI9rOUq6c2b7cwPkXdzfQESqvoqK6ug7U/Yyzug==
parseqs@0.0.5: parseqs@0.0.5:
version "0.0.5" version "0.0.5"
resolved "https://registry.yarnpkg.com/parseqs/-/parseqs-0.0.5.tgz#d5208a3738e46766e291ba2ea173684921a8b89d" resolved "https://registry.yarnpkg.com/parseqs/-/parseqs-0.0.5.tgz#d5208a3738e46766e291ba2ea173684921a8b89d"