Skip to content

Commit

Permalink
chore: code review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
alexeagle committed Nov 21, 2019
1 parent 8709fc7 commit 9802e88
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 18 deletions.
8 changes: 5 additions & 3 deletions examples/angular/src/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
load("@build_bazel_rules_nodejs//:index.bzl", "pkg_web")
load("@io_bazel_rules_docker//container:container.bzl", "container_image")
load("@io_bazel_rules_docker//nodejs:image.bzl", "nodejs_image")
load("@io_bazel_rules_sass//:defs.bzl", "sass_binary")
Expand All @@ -8,7 +9,6 @@ load("@npm_bazel_inject_html//:index.bzl", "inject_html")
load("@npm_bazel_rollup//:index.bzl", "rollup_bundle")
load("@npm_bazel_terser//:index.bzl", "terser_minified")
load("@npm_bazel_typescript//:index.bzl", "ts_config", "ts_devserver", "ts_library")
load("@build_bazel_rules_nodejs//index.bzl", "pkg_web")

package(default_visibility = ["//:__subpackages__"])

Expand Down Expand Up @@ -166,8 +166,10 @@ terser_minified(
inject_html(
name = "inject_scripts_for_prod",
src = "//src:example/index.prod.html",
# we can't produce "example/index.html" since that collides with the devmode file
# pkg_web rule will re-root this path because it starts with _prodapp
# we can't output "src/example/index.html" since that collides with the devmode file.
# pkg_web rule will re-root paths that start with _{name} by default
# so we output "_prodapp/src/example/index.html" so that it is mapped to
# `example/index.html` in the web package.
out = "_prodapp/src/example/index.html",
assets = _ASSETS,
)
Expand Down
5 changes: 3 additions & 2 deletions examples/app/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,16 @@ _ASSETS = [
"//styles:test.css",
]

# Copy index.html to the output folder, adding <script> and <link> tags
inject_html(
name = "inject_js_css_tags",
name = "inject_tags",
src = "index.html",
assets = _ASSETS,
)

pkg_web(
name = "package",
srcs = [":inject_js_css_tags"] + _ASSETS,
srcs = [":inject_tags"] + _ASSETS,
)

http_server(
Expand Down
1 change: 0 additions & 1 deletion examples/webapp/differential_loading.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ def differential_loading(name, entry_point, srcs):
name = name,
srcs = [
"index.html",
"styles.css",
"favicon.png",
name + "_chunks.min",
name + "_chunks_es5.min",
Expand Down
1 change: 0 additions & 1 deletion examples/webapp/styles.css

This file was deleted.

13 changes: 3 additions & 10 deletions packages/inject-html/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
load("@build_bazel_rules_nodejs//:index.bzl", "nodejs_binary", "npm_package")
load("@npm_bazel_jasmine//:index.from_src.bzl", "jasmine_node_test")

# For unit test
exports_files(["index.js"])

# For local testing without an npm install
nodejs_binary(
Expand All @@ -10,15 +12,6 @@ nodejs_binary(
visibility = ["//packages/inject-html:__subpackages__"],
)

jasmine_node_test(
name = "test",
srcs = ["spec.js"],
deps = [
":index.js",
"@npm//parse5",
],
)

npm_package(
name = "npm_package",
srcs = [
Expand Down
10 changes: 10 additions & 0 deletions packages/inject-html/test/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
load("@npm_bazel_jasmine//:index.from_src.bzl", "jasmine_node_test")
load("//internal/golden_file_test:golden_file_test.bzl", "golden_file_test")
load("//packages/inject-html:inject_html.bzl", "inject_html")

Expand Down Expand Up @@ -34,3 +35,12 @@ golden_file_test(
# Sed script doesn't work on Mac :shrug:
tags = ["no-bazelci-mac"],
)

jasmine_node_test(
name = "unit_test",
srcs = ["spec.js"],
deps = [
"//packages/inject-html:index.js",
"@npm//parse5",
],
)
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const injector = require('./');
const injector = require('..');

describe('HTML injector', () => {
const inFile = 'some/index.html';
Expand Down

0 comments on commit 9802e88

Please sign in to comment.