Skip to content

Commit 8c28cb9

Browse files
gregmagolannlopezgi
authored andcommitted
Update rules_nodejs to 0.42.3 release (#1324)
1 parent b2bf38d commit 8c28cb9

File tree

6 files changed

+41
-33
lines changed

6 files changed

+41
-33
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,3 +47,6 @@ bazel-testlogs
4747
# Eclipse and PyDev
4848
.project
4949
.pydevproject
50+
51+
# Npm packages
52+
node_modules

README.md

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -577,20 +577,18 @@ http_archive(
577577
name = "build_bazel_rules_nodejs",
578578
# Replace with a real SHA256 checksum
579579
sha256 = "{SHA256}"
580-
# Replace with a real commit SHA
581-
strip_prefix = "rules_nodejs-{HEAD}",
582-
urls = ["https://github.com/bazelbuild/rules_nodejs/archive/{HEAD}.tar.gz"],
580+
# Replace with a real release version
581+
urls = ["https://github.com/bazelbuild/rules_nodejs/releases/download/{VERSION}/rules_nodejs-{VERSION}.tar.gz"],
583582
)
584583

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

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

590587
# Install your declared Node.js dependencies
591588
npm_install(
592-
name = "npm_deps",
589+
name = "npm",
593590
package_json = "//:package.json",
591+
yarn_lock = "//:yarn.lock",
594592
)
595593

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

621619
nodejs_image(
622620
name = "nodejs_image",
623-
entry_point = "your_workspace/path/to/file.js",
621+
entry_point = "@your_workspace//path/to:file.js",
624622
# This will be put into its own layer.
625-
node_modules = "@npm_deps//:node_modules",
623+
node_modules = "@npm//:node_modules",
626624
data = [":file.js"],
627625
...
628626
)

WORKSPACE

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -352,18 +352,17 @@ d_repositories()
352352

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

360-
load("@build_bazel_rules_nodejs//:defs.bzl", "node_repositories", "npm_install")
359+
load("@build_bazel_rules_nodejs//:index.bzl", "yarn_install")
361360

362-
node_repositories(package_json = ["//testdata:package.json"])
363-
364-
npm_install(
365-
name = "npm_deps",
361+
yarn_install(
362+
name = "npm",
366363
package_json = "//testdata:package.json",
364+
symlink_node_modules = False,
365+
yarn_lock = "//testdata:yarn.lock",
367366
)
368367

369368
load(

nodejs/image.bzl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ The signature of this rule is compatible with nodejs_binary.
1717
"""
1818

1919
load("@bazel_skylib//lib:dicts.bzl", "dicts")
20-
load("@build_bazel_rules_nodejs//:defs.bzl", "nodejs_binary")
20+
load("@build_bazel_rules_nodejs//:index.bzl", "nodejs_binary")
2121
load(
2222
"//container:container.bzl",
2323
"container_pull",

testdata/yarn.lock

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
2+
# yarn lockfile v1
3+
4+
5+
jsesc@2.5.2:
6+
version "2.5.2"
7+
resolved "https://registry.yarnpkg.com/jsesc/-/jsesc-2.5.2.tgz#80564d2e483dacf6e8ef209650a67df3f0c283a4"
8+
integrity sha512-OYu7XEzjkCQ3C5Ps3QIZsQfNpqoJyZZA99wd9aWd05NCtC5pWOkShK2mkL6HXQR6/Cy2lbNdPlZBpuQHXE63gA==

tests/container/nodejs/BUILD

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
load("@build_bazel_rules_nodejs//:defs.bzl", "nodejs_binary")
15+
load("@build_bazel_rules_nodejs//:index.bzl", "nodejs_binary")
1616
load("//contrib:test.bzl", "container_test")
1717
load("//nodejs:image.bzl", "nodejs_image")
1818

@@ -26,43 +26,43 @@ nodejs_image(
2626
"arg1",
2727
],
2828
data = ["//testdata:nodejs_image.js"],
29-
entry_point = "io_bazel_rules_docker/testdata/nodejs_image.js",
30-
node_modules = "@npm_deps//:node_modules",
29+
entry_point = "@io_bazel_rules_docker//testdata:nodejs_image.js",
30+
node_modules = "@npm//:node_modules",
3131
)
3232

3333
# Docker Cmd value should be `[""]`.
3434
nodejs_image(
3535
name = "nodejs_image_list_with_empty_string_args",
3636
args = [""],
3737
data = ["//testdata:nodejs_image.js"],
38-
entry_point = "io_bazel_rules_docker/testdata/nodejs_image.js",
39-
node_modules = "@npm_deps//:node_modules",
38+
entry_point = "@io_bazel_rules_docker//testdata:nodejs_image.js",
39+
node_modules = "@npm//:node_modules",
4040
)
4141

4242
# Docker Cmd value should be `null`.
4343
nodejs_image(
4444
name = "nodejs_image_no_args",
4545
data = ["//testdata:nodejs_image.js"],
46-
entry_point = "io_bazel_rules_docker/testdata/nodejs_image.js",
47-
node_modules = "@npm_deps//:node_modules",
46+
entry_point = "@io_bazel_rules_docker//testdata:nodejs_image.js",
47+
node_modules = "@npm//:node_modules",
4848
)
4949

5050
# Docker Cmd value should be `null`.
5151
nodejs_image(
5252
name = "nodejs_image_empty_list_args",
5353
args = [],
5454
data = ["//testdata:nodejs_image.js"],
55-
entry_point = "io_bazel_rules_docker/testdata/nodejs_image.js",
56-
node_modules = "@npm_deps//:node_modules",
55+
entry_point = "@io_bazel_rules_docker//testdata:nodejs_image.js",
56+
node_modules = "@npm//:node_modules",
5757
)
5858

5959
# Docker Cmd value should be `null`.
6060
nodejs_image(
6161
name = "nodejs_image_none_args",
6262
args = None,
6363
data = ["//testdata:nodejs_image.js"],
64-
entry_point = "io_bazel_rules_docker/testdata/nodejs_image.js",
65-
node_modules = "@npm_deps//:node_modules",
64+
entry_point = "@io_bazel_rules_docker//testdata:nodejs_image.js",
65+
node_modules = "@npm//:node_modules",
6666
)
6767

6868
nodejs_binary(
@@ -72,14 +72,14 @@ nodejs_binary(
7272
"arg1",
7373
],
7474
data = ["//testdata:nodejs_image.js"],
75-
entry_point = "io_bazel_rules_docker/testdata/nodejs_image.js",
76-
node_modules = "@npm_deps//:node_modules",
75+
entry_point = "@io_bazel_rules_docker//testdata:nodejs_image.js",
76+
node_modules = "@npm//:node_modules",
7777
)
7878

7979
nodejs_image(
8080
name = "nodejs_image_custom_binary",
8181
binary = ":my_custom_binary",
82-
node_modules = "@npm_deps//:node_modules",
82+
node_modules = "@npm//:node_modules",
8383
)
8484

8585
nodejs_image(
@@ -89,7 +89,7 @@ nodejs_image(
8989
"arg1",
9090
],
9191
binary = ":my_custom_binary",
92-
node_modules = "@npm_deps//:node_modules",
92+
node_modules = "@npm//:node_modules",
9393
)
9494

9595
container_test(

0 commit comments

Comments
 (0)