build: update @angular/bazel schematics to use html_insert_assets & pkg_web (#34112)

PR Close #34112
This commit is contained in:
Greg Magolan 2019-11-27 14:45:45 -08:00 committed by Kara Erickson
parent bfeaa7d564
commit 7df2b4aeff
5 changed files with 109 additions and 74 deletions

View File

@ -29,21 +29,21 @@
"@bazel/terser": "0.42.1",
"@bazel/typescript": "0.42.1",
"@types/jasmine": "2.8.8",
"html-insert-assets": "^0.1.0",
"http-server": "0.11.1",
"html-insert-assets": "0.2.0",
"http-server": "0.12.0",
"karma": "4.4.1",
"karma-chrome-launcher": "3.1.0",
"karma-firefox-launcher": "1.2.0",
"karma-jasmine": "2.0.1",
"karma-requirejs": "1.1.0",
"karma-sourcemap-loader": "^0.3.7",
"karma-sourcemap-loader": "0.3.7",
"protractor": "5.4.2",
"requirejs": "2.3.6",
"rollup": "1.25.2",
"rollup": "1.27.5",
"rollup-plugin-commonjs": "10.1.0",
"rollup-plugin-node-resolve": "5.2.0",
"rollup-plugin-sourcemaps": "0.4.2",
"terser": "4.3.9",
"terser": "4.4.0",
"typescript": "3.6.4"
},
"scripts": {

View File

@ -38,7 +38,7 @@ 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 ond remap in ts_devserver & pkg_web
# We output "_/index.html" instead and remap in ts_devserver & pkg_web
# using additional_root_paths.
outs = ["_/index.html"],
args = [
@ -47,7 +47,7 @@ html_insert_assets(
"--out",
"$@",
"--assets",
# We load zone.js outside the bundle. That's because it's a "pollyfill"
# 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

View File

@ -507,6 +507,11 @@ base@^0.11.1:
mixin-deep "^1.2.0"
pascalcase "^0.1.1"
basic-auth@^1.0.3:
version "1.1.0"
resolved "https://registry.yarnpkg.com/basic-auth/-/basic-auth-1.1.0.tgz#45221ee429f7ee1e5035be3f51533f1cdfd29884"
integrity sha1-RSIe5Cn37h5QNb4/UVM/HN/SmIQ=
bcrypt-pbkdf@^1.0.0:
version "1.0.2"
resolved "https://registry.yarnpkg.com/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.2.tgz#a4301d389b6a43f9b67ff3ca11a3f6637e360e9e"
@ -752,12 +757,7 @@ collection-visit@^1.0.0:
map-visit "^1.0.0"
object-visit "^1.0.0"
colors@1.0.3:
version "1.0.3"
resolved "https://registry.yarnpkg.com/colors/-/colors-1.0.3.tgz#0433f44d809680fdeb60ed260f1b0c262e82a40b"
integrity sha1-BDP0TYCWgP3rYO0mDxsMJi6CpAs=
colors@^1.1.0:
colors@^1.1.0, colors@^1.3.3:
version "1.4.0"
resolved "https://registry.yarnpkg.com/colors/-/colors-1.4.0.tgz#c50491479d4c1bdaed2c9ced32cf7c7dc2360f78"
integrity sha512-a+UqTh4kgZg/SlGvfbzDHpgRu7AAQOmmqRHJnxhRZICKFUT91brVhNNt58CMWU9PsBbv3PDCZUHbVxuDiH2mtA==
@ -846,7 +846,7 @@ core-util-is@1.0.2, core-util-is@~1.0.0:
resolved "https://registry.yarnpkg.com/core-util-is/-/core-util-is-1.0.2.tgz#b5fd54220aa2bc5ab57aab7140c940754503c1a7"
integrity sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=
corser@~2.0.0:
corser@^2.0.1:
version "2.0.1"
resolved "https://registry.yarnpkg.com/corser/-/corser-2.0.1.tgz#8eda252ecaab5840dcd975ceb90d9370c819ff87"
integrity sha1-jtolLsqrWEDc2XXOuQ2TcMgZ/4c=
@ -1012,7 +1012,7 @@ ecc-jsbn@~0.1.1:
jsbn "~0.1.0"
safer-buffer "^2.1.0"
ecstatic@^3.0.0:
ecstatic@^3.3.2:
version "3.3.2"
resolved "https://registry.yarnpkg.com/ecstatic/-/ecstatic-3.3.2.tgz#6d1dd49814d00594682c652adb66076a69d46c48"
integrity sha512-fLf9l1hnwrHI2xn9mEDT7KIi22UDqA2jaCwyCbSUJh9a1V+LEUSL/JO/6TIz/QyuBURWUHrFL5Kg2TtO1bkkog==
@ -1524,10 +1524,10 @@ he@^1.1.1:
resolved "https://registry.yarnpkg.com/he/-/he-1.2.0.tgz#84ae65fa7eafb165fddb61566ae14baf05664f0f"
integrity sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw==
html-insert-assets@^0.1.0:
version "0.1.0"
resolved "https://registry.yarnpkg.com/html-insert-assets/-/html-insert-assets-0.1.0.tgz#45987e6591297b12182cbebb8e551aac077b185d"
integrity sha512-0XsuYUo5XWljsjoBb13LZgdnaz+wxfCTzyoJ/TK9QoEaSO/+bBA7aF7VGhh+j4LZOMLtg6kb7WDXX027UY8qJg==
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"
@ -1542,7 +1542,7 @@ http-errors@1.7.2:
statuses ">= 1.5.0 < 2"
toidentifier "1.0.0"
http-proxy@^1.13.0, http-proxy@^1.8.1:
http-proxy@^1.13.0, http-proxy@^1.17.0:
version "1.18.0"
resolved "https://registry.yarnpkg.com/http-proxy/-/http-proxy-1.18.0.tgz#dbe55f63e75a347db7f3d99974f2692a314a6a3a"
integrity sha512-84I2iJM/n1d4Hdgc6y2+qY5mDaz2PUVjlg9znE9byl+q0uC3DeByqBGReQu5tpLK0TAqTIXScRUV+dg7+bUPpQ==
@ -1551,19 +1551,21 @@ http-proxy@^1.13.0, http-proxy@^1.8.1:
follow-redirects "^1.0.0"
requires-port "^1.0.0"
http-server@0.11.1:
version "0.11.1"
resolved "https://registry.yarnpkg.com/http-server/-/http-server-0.11.1.tgz#2302a56a6ffef7f9abea0147d838a5e9b6b6a79b"
integrity sha512-6JeGDGoujJLmhjiRGlt8yK8Z9Kl0vnl/dQoQZlc4oeqaUoAKQg94NILLfrY3oWzSyFaQCVNTcKE5PZ3cH8VP9w==
http-server@0.12.0:
version "0.12.0"
resolved "https://registry.yarnpkg.com/http-server/-/http-server-0.12.0.tgz#316b450603c0454d4a462d97a3132808a9858563"
integrity sha512-imGLDSTT1BZ0QG1rBFnaZ6weK5jeisUnCxZQI1cpYTdz0luPUM5e3s+WU5zRWEkiI6DQxL2p54oeKrDlzO6bRw==
dependencies:
colors "1.0.3"
corser "~2.0.0"
ecstatic "^3.0.0"
http-proxy "^1.8.1"
opener "~1.4.0"
optimist "0.6.x"
portfinder "^1.0.13"
union "~0.4.3"
basic-auth "^1.0.3"
colors "^1.3.3"
corser "^2.0.1"
ecstatic "^3.3.2"
http-proxy "^1.17.0"
opener "^1.5.1"
optimist "~0.6.1"
portfinder "^1.0.20"
secure-compare "3.0.1"
union "~0.5.0"
http-signature@~1.2.0:
version "1.2.0"
@ -1982,7 +1984,7 @@ karma-requirejs@1.1.0:
resolved "https://registry.yarnpkg.com/karma-requirejs/-/karma-requirejs-1.1.0.tgz#fddae2cb87d7ebc16fb0222893564d7fee578798"
integrity sha1-/driy4fX68FvsCIok1ZNf+5Xh5g=
karma-sourcemap-loader@^0.3.7:
karma-sourcemap-loader@0.3.7:
version "0.3.7"
resolved "https://registry.yarnpkg.com/karma-sourcemap-loader/-/karma-sourcemap-loader-0.3.7.tgz#91322c77f8f13d46fed062b042e1009d4c4505d8"
integrity sha1-kTIsd/jxPUb+0GKwQuEAnUxFBdg=
@ -2436,12 +2438,12 @@ once@^1.3.0, once@^1.3.1, once@^1.4.0:
dependencies:
wrappy "1"
opener@~1.4.0:
version "1.4.3"
resolved "https://registry.yarnpkg.com/opener/-/opener-1.4.3.tgz#5c6da2c5d7e5831e8ffa3964950f8d6674ac90b8"
integrity sha1-XG2ixdflgx6P+jlklQ+NZnSskLg=
opener@^1.5.1:
version "1.5.1"
resolved "https://registry.yarnpkg.com/opener/-/opener-1.5.1.tgz#6d2f0e77f1a0af0032aca716c2c1fbb8e7e8abed"
integrity sha512-goYSy5c2UXE4Ra1xixabeVh1guIX/ZV/YokJksb6q2lubWu6UbvPQ20p542/sFIll1nl8JnCyK9oBaOcCWXwvA==
optimist@0.6.x, optimist@^0.6.1, optimist@~0.6.0:
optimist@^0.6.1, optimist@~0.6.0, optimist@~0.6.1:
version "0.6.1"
resolved "https://registry.yarnpkg.com/optimist/-/optimist-0.6.1.tgz#da3ea74686fa21a19a111c326e90eb15a0196686"
integrity sha1-2j6nRob6IaGaERwybpDrFaAZZoY=
@ -2606,7 +2608,7 @@ pinkie@^2.0.0:
resolved "https://registry.yarnpkg.com/pinkie/-/pinkie-2.0.4.tgz#72556b80cfa0d48a974e80e77248e80ed4f7f870"
integrity sha1-clVrgM+g1IqXToDnckjoDtT3+HA=
portfinder@^1.0.13:
portfinder@^1.0.20:
version "1.0.25"
resolved "https://registry.yarnpkg.com/portfinder/-/portfinder-1.0.25.tgz#254fd337ffba869f4b9d37edc298059cb4d35eca"
integrity sha512-6ElJnHBbxVA1XSLgBp7G1FiCkQdlqGzuF7DswL5tcea+E8UpuvPU7beVAjjRwCioTS9ZluNbu+ZyRvgTsmqEBg==
@ -2713,10 +2715,10 @@ qs@6.7.0:
resolved "https://registry.yarnpkg.com/qs/-/qs-6.7.0.tgz#41dc1a015e3d581f1621776be31afb2876a9b1bc"
integrity sha512-VCdBRNFTX1fyE7Nb6FYoURo/SPe62QCaAyzJvUjwRaIsc+NePBEniHlvxFmmX56+HZphIGtV0XeCirBtpDrTyQ==
qs@~2.3.3:
version "2.3.3"
resolved "https://registry.yarnpkg.com/qs/-/qs-2.3.3.tgz#e9e85adbe75da0bbe4c8e0476a086290f863b404"
integrity sha1-6eha2+ddoLvkyOBHaghikPhjtAQ=
qs@^6.4.0:
version "6.9.1"
resolved "https://registry.yarnpkg.com/qs/-/qs-6.9.1.tgz#20082c65cb78223635ab1a9eaca8875a29bf8ec9"
integrity sha512-Cxm7/SS/y/Z3MHWSxXb8lIFqgqBowP5JMlTUFyJN88y0SGQhVmZnqFK/PeuMX9LzUyWsqqhNxIyg0jlzq946yA==
qs@~6.5.2:
version "6.5.2"
@ -2936,10 +2938,10 @@ rollup-pluginutils@^2.0.1, rollup-pluginutils@^2.8.1:
dependencies:
estree-walker "^0.6.1"
rollup@1.25.2:
version "1.25.2"
resolved "https://registry.yarnpkg.com/rollup/-/rollup-1.25.2.tgz#739f508bd8f7ece52bb6c1fcda83466af82b7f6d"
integrity sha512-+7z6Wab/L45QCPcfpuTZKwKiB0tynj05s/+s2U3F2Bi7rOLPr9UcjUwO7/xpjlPNXA/hwnth6jBExFRGyf3tMg==
rollup@1.27.5:
version "1.27.5"
resolved "https://registry.yarnpkg.com/rollup/-/rollup-1.27.5.tgz#d100fb0ffd8353575cb2057152547b9abfddfe59"
integrity sha512-8rfVdzuTg2kt8ObD9LNJpEwUN7B6lsl3sHc5fddtgICpLjpYeSf4m2+RftBzcCaBTMi1iYX3Ez8zFT4Gj2nJjg==
dependencies:
"@types/estree" "*"
"@types/node" "*"
@ -2984,6 +2986,11 @@ sax@>=0.6.0, sax@^1.2.4:
resolved "https://registry.yarnpkg.com/sax/-/sax-1.2.4.tgz#2816234e2378bddc4e5354fab5caa895df7100d9"
integrity sha512-NqVDv9TpANUjFm0N8uM5GxL36UgKi9/atZw+x7YFnQ8ckwFGKrl4xX4yWtrey3UJm5nP1kUbnYgLopqWNSRhWw==
secure-compare@3.0.1:
version "3.0.1"
resolved "https://registry.yarnpkg.com/secure-compare/-/secure-compare-3.0.1.tgz#f1a0329b308b221fae37b9974f3d578d0ca999e3"
integrity sha1-8aAymzCLIh+uN7mXTz1XjQypmeM=
selenium-webdriver@3.6.0, selenium-webdriver@^3.0.1:
version "3.6.0"
resolved "https://registry.yarnpkg.com/selenium-webdriver/-/selenium-webdriver-3.6.0.tgz#2ba87a1662c020b8988c981ae62cb2a01298eafc"
@ -3339,10 +3346,10 @@ tar@^4:
safe-buffer "^5.1.2"
yallist "^3.0.3"
terser@4.3.9:
version "4.3.9"
resolved "https://registry.yarnpkg.com/terser/-/terser-4.3.9.tgz#e4be37f80553d02645668727777687dad26bbca8"
integrity sha512-NFGMpHjlzmyOtPL+fDw3G7+6Ueh/sz4mkaUYa4lJCxOPTNzd0Uj0aZJOmsDYoSQyfuVoWDMSWTPU3huyOm2zdA==
terser@4.4.0:
version "4.4.0"
resolved "https://registry.yarnpkg.com/terser/-/terser-4.4.0.tgz#22c46b4817cf4c9565434bfe6ad47336af259ac3"
integrity sha512-oDG16n2WKm27JO8h4y/w3iqBGAOSCtq7k8dRmrn4Wf9NouL0b2WpMHGChFGZq4nFAQy1FsNJrVQHfurXOSTmOA==
dependencies:
commander "^2.20.0"
source-map "~0.6.1"
@ -3484,12 +3491,12 @@ union-value@^1.0.0:
is-extendable "^0.1.1"
set-value "^2.0.1"
union@~0.4.3:
version "0.4.6"
resolved "https://registry.yarnpkg.com/union/-/union-0.4.6.tgz#198fbdaeba254e788b0efcb630bc11f24a2959e0"
integrity sha1-GY+9rrolTniLDvy2MLwR8kopWeA=
union@~0.5.0:
version "0.5.0"
resolved "https://registry.yarnpkg.com/union/-/union-0.5.0.tgz#b2c11be84f60538537b846edb9ba266ba0090075"
integrity sha512-N6uOhuW6zO95P3Mel2I2zMsbsanvvtgn6jVqJv4vbVcz/JN0OkL9suomjQGmWtxJQXOCqUJvquc1sMeNz/IwlA==
dependencies:
qs "~2.3.3"
qs "^6.4.0"
universalify@^0.1.0:
version "0.1.2"

View File

@ -1,9 +1,10 @@
package(default_visibility = ["//visibility:public"])
load("@build_bazel_rules_nodejs//:index.bzl", "pkg_web")
load("@npm//history-server:index.bzl", "history_server")
load("@npm//html-insert-assets:index.bzl", "html_insert_assets")
load("@npm_angular_bazel//:index.bzl", "ng_module")
load("@npm_bazel_karma//:index.bzl", "karma_web_test_suite")
load("@build_bazel_rules_nodejs//internal/web_package:web_package.bzl", "web_package")
load("@npm//history-server:index.bzl", "history_server")
load("@npm_bazel_rollup//:index.bzl", "rollup_bundle")
load("@npm_bazel_terser//:index.bzl", "terser_minified")
load("@npm_bazel_typescript//:index.bzl", "ts_devserver", "ts_library")
@ -64,18 +65,38 @@ terser_minified(
src = ":bundle",
)
web_package(
html_insert_assets(
name = "inject_scripts",
outs = ["_/index.html"],
args = [
"--html",
"$(location :index.html)",
"--out",
"$@",
"--roots",
"$(RULEDIR)",
"--assets",
"$(location :global_stylesheet.css)",
"$(location @npm//:node_modules/zone.js/dist/zone.min.js)",
"bundle.min.js",
],
data = [
":index.html",
":global_stylesheet.css",
"@npm//:node_modules/zone.js/dist/zone.min.js",
],
)
pkg_web(
name = "prodapp",
assets = [
# do not sort
additional_root_paths = ["src/_"],
srcs = [
"@npm//:node_modules/zone.js/dist/zone.min.js",
":bundle.min",
":global_stylesheet",
],
data = [
":inject_scripts",
"favicon.ico",
],
index_html = "index.html",
)
history_server(
@ -95,6 +116,7 @@ filegroup(
ts_devserver(
name = "devserver",
additional_root_paths = ["src/_"],
port = 4200,
entry_module = "project/src/main.dev",
serving_path = "/bundle.min.js",
@ -105,11 +127,9 @@ ts_devserver(
static_files = [
"@npm//:node_modules/zone.js/dist/zone.min.js",
":global_stylesheet",
],
data = [
":inject_scripts",
"favicon.ico",
],
index_html = "index.html",
deps = [":src"],
)
@ -158,6 +178,5 @@ karma_web_test_suite(
deps = [
":rxjs_umd_modules",
":test_lib",
"@npm//karma-jasmine",
],
)

View File

@ -39,17 +39,26 @@ function addDevDependenciesToPackageJson(options: Schema) {
const devDependencies: [string, string][] = [
['@angular/bazel', angularCore.version],
['@bazel/bazel', '1.1.0'],
['@bazel/ibazel', '^0.10.2'],
['@bazel/ibazel', '0.10.3'],
['@bazel/karma', '0.42.1'],
['@bazel/protractor', '0.42.1'],
['@bazel/rollup', '0.42.1'],
['@bazel/terser', '0.42.1'],
['@bazel/typescript', '0.42.1'],
['history-server', '^1.3.1'],
['rollup', '^1.25.2'],
['rollup-plugin-commonjs', '^10.1.0'],
['rollup-plugin-node-resolve', '^5.2.0'],
['terser', '^4.3.9'],
['history-server', '1.3.1'],
['html-insert-assets', '0.2.0'],
['karma', '4.4.1'],
['karma-chrome-launcher', '3.1.0'],
['karma-firefox-launcher', '1.2.0'],
['karma-jasmine', '2.0.1'],
['karma-requirejs', '1.1.0'],
['karma-sourcemap-loader', '0.3.7'],
['protractor', '5.4.2'],
['requirejs', '2.3.6'],
['rollup', '1.27.5'],
['rollup-plugin-commonjs', '10.1.0'],
['rollup-plugin-node-resolve', '5.2.0'],
['terser', '4.4.0'],
];
for (const [name, version] of devDependencies) {