Skip to content

Commit

Permalink
refactor: remove http_server and history_server rules (#1158)
Browse files Browse the repository at this point in the history
BREAKING CHANGE:
history_server and http_server rules are no longer built-in.

To use them, first install the http-server and/or history-server packages
Then load("@npm//http-server:index.bzl", "http_server")
(or replace with history-server, noting that the rule has underscore where the package has hyphen)
  • Loading branch information
alexeagle authored Sep 20, 2019
1 parent d846f45 commit 01fdeec
Show file tree
Hide file tree
Showing 41 changed files with 1,056 additions and 1,659 deletions.
4 changes: 0 additions & 4 deletions BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,6 @@ bzl_library(
visibility = ["//visibility:public"],
deps = [
"//internal/common:bzl",
"//internal/history-server:bzl",
"//internal/http-server:bzl",
"//internal/jasmine_node_test:bzl",
"//internal/linker:bzl",
"//internal/npm_package:bzl",
Expand Down Expand Up @@ -86,8 +84,6 @@ npm_package(
"//internal/golden_file_test:package_contents",
"//internal/common:package_contents",
"//internal/copy_repository:package_contents",
"//internal/history-server:package_contents",
"//internal/http-server:package_contents",
"//internal/jasmine_node_test:package_contents",
"//internal/js_library:package_contents",
"//internal/linker:package_contents",
Expand Down
4 changes: 0 additions & 4 deletions defs.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@ Users should not load files under "/internal"

load("//internal/common:check_bazel_version.bzl", _check_bazel_version = "check_bazel_version")
load("//internal/common:check_version.bzl", "check_version")
load("//internal/history-server:history_server.bzl", _history_server = "history_server")
load("//internal/http-server:http_server.bzl", _http_server = "http_server")
load("//internal/jasmine_node_test:jasmine_node_test.bzl", _jasmine_node_test = "jasmine_node_test")
load(
"//internal/node:node.bzl",
Expand All @@ -40,8 +38,6 @@ node_repositories = _node_repositories
jasmine_node_test = _jasmine_node_test
rollup_bundle = _rollup_bundle
npm_package = _npm_package
history_server = _history_server
http_server = _http_server
npm_package_bin = _npm_bin
# ANY RULES ADDED HERE SHOULD BE DOCUMENTED, see index.for_docs.bzl

Expand Down
5 changes: 4 additions & 1 deletion docs/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,10 @@ stardoc(
name = "builtins",
out = "builtins.api",
input = "//:index.for_docs.bzl",
deps = ["//:bzl"],
deps = [
"//:bzl",
"//internal/node:bzl",
],
)

_BUILTINS_README = "# Built-in rules\n\nThese rules are available without any npm installation, via the `WORKSPACE` install of the `build_bazel_rules_nodejs` workspace. This is necessary to bootstrap Bazel to run the package manager to download other rules from NPM.\n\n"
Expand Down
1 change: 1 addition & 0 deletions examples/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ load(":test.bzl", "example_integration_test")

example_integration_test(
name = "examples_angular",
timeout = "long",
npm_packages = {
"//packages/karma:npm_package": "@bazel/karma",
"//packages/protractor:npm_package": "@bazel/protractor",
Expand Down
1 change: 1 addition & 0 deletions examples/angular/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
"@types/node": "6.14.6",
"core-js": "2.6.9",
"firebase-tools": "7.1.0",
"history-server": "^1.3.1",
"ts-morph": "3.1.0",
"typescript": "3.4.5"
},
Expand Down
7 changes: 4 additions & 3 deletions examples/angular/src/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
load("@build_bazel_rules_nodejs//:defs.bzl", "history_server", "rollup_bundle")
load("@build_bazel_rules_nodejs//:defs.bzl", "rollup_bundle")
load("@build_bazel_rules_nodejs//internal/web_package:web_package.bzl", "web_package")
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")
load("@npm//history-server:index.bzl", "history_server")
load("@npm_angular_bazel//:index.bzl", "ng_module")
load("@npm_bazel_typescript//:defs.bzl", "ts_config", "ts_devserver", "ts_library")

Expand Down Expand Up @@ -176,8 +177,8 @@ history_server(
nodejs_image(
name = "nodejs_image",
data = [":prodapp"],
entry_point = "@history-server_runtime_deps//:node_modules/history-server/modules/cli.js",
node_modules = "@history-server_runtime_deps//:node_modules",
entry_point = "@npm//:node_modules/history-server/modules/cli.js",
node_modules = "@npm//:node_modules",
# Actions created by this rule are I/O-bound,
# so there is no benefit to running them remotely
tags = ["local"],
Expand Down
59 changes: 59 additions & 0 deletions examples/angular/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2112,6 +2112,11 @@ eventemitter3@^3.0.0:
resolved "https://registry.yarnpkg.com/eventemitter3/-/eventemitter3-3.1.0.tgz#090b4d6cdbd645ed10bf750d4b5407942d7ba163"
integrity sha512-ivIvhpq/Y0uSjcHDcOIccjmYjGLcP09MFGE7ysAwkAvkXfpZlC985pH2/ui64DKazbTW/4kN3yqozUxlXzI6cA==

eventemitter3@^4.0.0:
version "4.0.0"
resolved "https://registry.yarnpkg.com/eventemitter3/-/eventemitter3-4.0.0.tgz#d65176163887ee59f386d64c82610b696a4a74eb"
integrity sha512-qerSRB0p+UDEssxTtm6EDKcE7W4OaoisfIMl4CngyEhjpYglocpNg6UEqCvemdGhosAsg4sO2dXJOdyBifPGCg==

execa@^0.7.0:
version "0.7.0"
resolved "https://registry.yarnpkg.com/execa/-/execa-0.7.0.tgz#944becd34cc41ee32a63a9faf27ad5a65fc59777"
Expand Down Expand Up @@ -2166,6 +2171,42 @@ expand-brackets@^2.1.4:
snapdragon "^0.8.1"
to-regex "^3.0.1"

express@^4.14.0:
version "4.17.1"
resolved "https://registry.yarnpkg.com/express/-/express-4.17.1.tgz#4491fc38605cf51f8629d39c2b5d026f98a4c134"
integrity sha512-mHJ9O79RqluphRrcw2X/GTh3k9tVv8YcoyY4Kkh4WDMUYKRZUq0h1o0w2rrrxBqM7VoeUVqgb27xlEMXTnYt4g==
dependencies:
accepts "~1.3.7"
array-flatten "1.1.1"
body-parser "1.19.0"
content-disposition "0.5.3"
content-type "~1.0.4"
cookie "0.4.0"
cookie-signature "1.0.6"
debug "2.6.9"
depd "~1.1.2"
encodeurl "~1.0.2"
escape-html "~1.0.3"
etag "~1.8.1"
finalhandler "~1.1.2"
fresh "0.5.2"
merge-descriptors "1.0.1"
methods "~1.1.2"
on-finished "~2.3.0"
parseurl "~1.3.3"
path-to-regexp "0.1.7"
proxy-addr "~2.0.5"
qs "6.7.0"
range-parser "~1.2.1"
safe-buffer "5.1.2"
send "0.17.1"
serve-static "1.14.1"
setprototypeof "1.1.1"
statuses "~1.5.0"
type-is "~1.6.18"
utils-merge "1.0.1"
vary "~1.1.2"

express@^4.16.4:
version "4.17.0"
resolved "https://registry.yarnpkg.com/express/-/express-4.17.0.tgz#288af62228a73f4c8ea2990ba3b791bb87cd4438"
Expand Down Expand Up @@ -2860,6 +2901,15 @@ has@^1.0.1, has@^1.0.3:
dependencies:
function-bind "^1.1.1"

history-server@^1.3.1:
version "1.3.1"
resolved "https://registry.yarnpkg.com/history-server/-/history-server-1.3.1.tgz#4d79f1592293f88fd55e5000b4d2a71d713337c0"
integrity sha512-P8sDAn5gj54hLTvhV0iagtgKTNIcf8ynn+BC/AjfTGwYXsuhQsinMbCphPJfxCzN10FG7N0c0kX1tdtVkRU3Vw==
dependencies:
express "^4.14.0"
glob "^7.1.1"
http-proxy "^1.16.2"

home-dir@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/home-dir/-/home-dir-1.0.0.tgz#2917eb44bdc9072ceda942579543847e3017fe4e"
Expand Down Expand Up @@ -2913,6 +2963,15 @@ http-proxy@^1.13.0:
follow-redirects "^1.0.0"
requires-port "^1.0.0"

http-proxy@^1.16.2:
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==
dependencies:
eventemitter3 "^4.0.0"
follow-redirects "^1.0.0"
requires-port "^1.0.0"

http-signature@~1.2.0:
version "1.2.0"
resolved "https://registry.yarnpkg.com/http-signature/-/http-signature-1.2.0.tgz#9aecd925114772f3d95b65a60abb8f7c18fbace1"
Expand Down
3 changes: 2 additions & 1 deletion examples/app/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
load("@build_bazel_rules_nodejs//:defs.bzl", "http_server", "rollup_bundle")
load("@build_bazel_rules_nodejs//:defs.bzl", "rollup_bundle")
load("@build_bazel_rules_nodejs//internal/web_package:web_package.bzl", "web_package")
load("@npm//http-server:index.bzl", "http_server")
load("@npm_bazel_protractor//:index.bzl", "protractor_web_test_suite")
load("@npm_bazel_typescript//:index.bzl", "ts_config", "ts_devserver", "ts_library")

Expand Down
1 change: 1 addition & 0 deletions examples/app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"@bazel/protractor": "latest",
"@bazel/typescript": "latest",
"@types/jasmine": "3.3.15",
"http-server": "^0.11.1",
"less": "^3.10.3",
"stylus": "^0.54.7",
"typescript": "2.7.x"
Expand Down
10 changes: 5 additions & 5 deletions examples/app/styles/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,6 @@ package(default_visibility = ["//:__pkg__"])

lessc(
name = "base",
srcs = [
"base.less",
"variables.less",
],
outs = [
"base.css",
"base.css.map",
Expand All @@ -20,11 +16,14 @@ lessc(
"--silent",
"--source-map",
],
data = [
"base.less",
"variables.less",
],
)

stylus(
name = "styles",
srcs = ["test.styl"],
outs = [
"test.css",
"test.css.map",
Expand All @@ -37,6 +36,7 @@ stylus(
"--compress",
"--sourcemap",
],
data = ["test.styl"],
)

# For testing from the root workspace of this repository with bazel_integration_test.
Expand Down
Loading

0 comments on commit 01fdeec

Please sign in to comment.