Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update rules_nodejs to 0.42.3 #1324

Merged
merged 1 commit into from
Dec 17, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -47,3 +47,6 @@ bazel-testlogs
# Eclipse and PyDev
.project
.pydevproject

# Npm packages
node_modules
16 changes: 7 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -577,20 +577,18 @@ http_archive(
name = "build_bazel_rules_nodejs",
# Replace with a real SHA256 checksum
sha256 = "{SHA256}"
# Replace with a real commit SHA
strip_prefix = "rules_nodejs-{HEAD}",
urls = ["https://github.com/bazelbuild/rules_nodejs/archive/{HEAD}.tar.gz"],
# Replace with a real release version
urls = ["https://github.com/bazelbuild/rules_nodejs/releases/download/{VERSION}/rules_nodejs-{VERSION}.tar.gz"],
)

load("@build_bazel_rules_nodejs//:defs.bzl", "node_repositories", "npm_install")

# Download Node toolchain, etc.
node_repositories(package_json = ["//:package.json"])
load("@build_bazel_rules_nodejs//:index.bzl", "npm_install")

# Install your declared Node.js dependencies
npm_install(
name = "npm_deps",
name = "npm",
package_json = "//:package.json",
yarn_lock = "//:yarn.lock",
)

load(
@@ -620,9 +618,9 @@ load("@io_bazel_rules_docker//nodejs:image.bzl", "nodejs_image")

nodejs_image(
name = "nodejs_image",
entry_point = "your_workspace/path/to/file.js",
entry_point = "@your_workspace//path/to:file.js",
# This will be put into its own layer.
node_modules = "@npm_deps//:node_modules",
node_modules = "@npm//:node_modules",
data = [":file.js"],
...
)
15 changes: 7 additions & 8 deletions WORKSPACE
Original file line number Diff line number Diff line change
@@ -352,18 +352,17 @@ d_repositories()

http_archive(
name = "build_bazel_rules_nodejs",
sha256 = "9b72bb0aea72d7cbcfc82a01b1e25bf3d85f791e790ddec16c65e2d906382ee0",
strip_prefix = "rules_nodejs-0.16.2",
urls = ["https://github.com/bazelbuild/rules_nodejs/archive/0.16.2.zip"],
sha256 = "a54b2511d6dae42c1f7cdaeb08144ee2808193a088004fc3b464a04583d5aa2e",
urls = ["https://github.com/bazelbuild/rules_nodejs/releases/download/0.42.3/rules_nodejs-0.42.3.tar.gz"],
)

load("@build_bazel_rules_nodejs//:defs.bzl", "node_repositories", "npm_install")
load("@build_bazel_rules_nodejs//:index.bzl", "yarn_install")

node_repositories(package_json = ["//testdata:package.json"])

npm_install(
name = "npm_deps",
yarn_install(
name = "npm",
package_json = "//testdata:package.json",
symlink_node_modules = False,
yarn_lock = "//testdata:yarn.lock",
)

load(
2 changes: 1 addition & 1 deletion nodejs/image.bzl
Original file line number Diff line number Diff line change
@@ -17,7 +17,7 @@ The signature of this rule is compatible with nodejs_binary.
"""

load("@bazel_skylib//lib:dicts.bzl", "dicts")
load("@build_bazel_rules_nodejs//:defs.bzl", "nodejs_binary")
load("@build_bazel_rules_nodejs//:index.bzl", "nodejs_binary")
load(
"//container:container.bzl",
"container_pull",
8 changes: 8 additions & 0 deletions testdata/yarn.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
# yarn lockfile v1


jsesc@2.5.2:
version "2.5.2"
resolved "https://registry.yarnpkg.com/jsesc/-/jsesc-2.5.2.tgz#80564d2e483dacf6e8ef209650a67df3f0c283a4"
integrity sha512-OYu7XEzjkCQ3C5Ps3QIZsQfNpqoJyZZA99wd9aWd05NCtC5pWOkShK2mkL6HXQR6/Cy2lbNdPlZBpuQHXE63gA==
30 changes: 15 additions & 15 deletions tests/container/nodejs/BUILD
Original file line number Diff line number Diff line change
@@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

load("@build_bazel_rules_nodejs//:defs.bzl", "nodejs_binary")
load("@build_bazel_rules_nodejs//:index.bzl", "nodejs_binary")
load("//contrib:test.bzl", "container_test")
load("//nodejs:image.bzl", "nodejs_image")

@@ -26,43 +26,43 @@ nodejs_image(
"arg1",
],
data = ["//testdata:nodejs_image.js"],
entry_point = "io_bazel_rules_docker/testdata/nodejs_image.js",
node_modules = "@npm_deps//:node_modules",
entry_point = "@io_bazel_rules_docker//testdata:nodejs_image.js",
node_modules = "@npm//:node_modules",
)

# Docker Cmd value should be `[""]`.
nodejs_image(
name = "nodejs_image_list_with_empty_string_args",
args = [""],
data = ["//testdata:nodejs_image.js"],
entry_point = "io_bazel_rules_docker/testdata/nodejs_image.js",
node_modules = "@npm_deps//:node_modules",
entry_point = "@io_bazel_rules_docker//testdata:nodejs_image.js",
node_modules = "@npm//:node_modules",
)

# Docker Cmd value should be `null`.
nodejs_image(
name = "nodejs_image_no_args",
data = ["//testdata:nodejs_image.js"],
entry_point = "io_bazel_rules_docker/testdata/nodejs_image.js",
node_modules = "@npm_deps//:node_modules",
entry_point = "@io_bazel_rules_docker//testdata:nodejs_image.js",
node_modules = "@npm//:node_modules",
)

# Docker Cmd value should be `null`.
nodejs_image(
name = "nodejs_image_empty_list_args",
args = [],
data = ["//testdata:nodejs_image.js"],
entry_point = "io_bazel_rules_docker/testdata/nodejs_image.js",
node_modules = "@npm_deps//:node_modules",
entry_point = "@io_bazel_rules_docker//testdata:nodejs_image.js",
node_modules = "@npm//:node_modules",
)

# Docker Cmd value should be `null`.
nodejs_image(
name = "nodejs_image_none_args",
args = None,
data = ["//testdata:nodejs_image.js"],
entry_point = "io_bazel_rules_docker/testdata/nodejs_image.js",
node_modules = "@npm_deps//:node_modules",
entry_point = "@io_bazel_rules_docker//testdata:nodejs_image.js",
node_modules = "@npm//:node_modules",
)

nodejs_binary(
@@ -72,14 +72,14 @@ nodejs_binary(
"arg1",
],
data = ["//testdata:nodejs_image.js"],
entry_point = "io_bazel_rules_docker/testdata/nodejs_image.js",
node_modules = "@npm_deps//:node_modules",
entry_point = "@io_bazel_rules_docker//testdata:nodejs_image.js",
node_modules = "@npm//:node_modules",
)

nodejs_image(
name = "nodejs_image_custom_binary",
binary = ":my_custom_binary",
node_modules = "@npm_deps//:node_modules",
node_modules = "@npm//:node_modules",
)

nodejs_image(
@@ -89,7 +89,7 @@ nodejs_image(
"arg1",
],
binary = ":my_custom_binary",
node_modules = "@npm_deps//:node_modules",
node_modules = "@npm//:node_modules",
)

container_test(