Skip to content
This repository has been archived by the owner on Oct 2, 2023. It is now read-only.

Commit

Permalink
Update rules_nodejs to 0.42.3 release (#1324)
Browse files Browse the repository at this point in the history
  • Loading branch information
gregmagolan authored and nlopezgi committed Dec 17, 2019
1 parent b2bf38d commit 8c28cb9
Show file tree
Hide file tree
Showing 6 changed files with 41 additions and 33 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Up @@ -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(
Expand Down Expand Up @@ -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"],
...
)
Expand Down
15 changes: 7 additions & 8 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
2 changes: 1 addition & 1 deletion nodejs/image.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
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
Expand Up @@ -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")

Expand All @@ -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(
Expand All @@ -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(
Expand All @@ -89,7 +89,7 @@ nodejs_image(
"arg1",
],
binary = ":my_custom_binary",
node_modules = "@npm_deps//:node_modules",
node_modules = "@npm//:node_modules",
)

container_test(
Expand Down

0 comments on commit 8c28cb9

Please sign in to comment.