v1.38.0
Many companies are successfully building with rules_js.
If you're getting value from the project, please let us know!
Just comment on our Adoption Discussion.
Using Bzlmod with Bazel 6:
Add to your MODULE.bazel
file:
bazel_dep(name = "aspect_rules_js", version = "1.38.0")
####### Node.js version #########
# By default you get the node version from DEFAULT_NODE_VERSION in @rules_nodejs//nodejs:repositories.bzl
# Optionally you can pin a different node version:
bazel_dep(name = "rules_nodejs", version = "5.8.2")
node = use_extension("@rules_nodejs//nodejs:extensions.bzl", "node")
node.toolchain(node_version = "16.14.2")
#################################
npm = use_extension("@aspect_rules_js//npm:extensions.bzl", "npm", dev_dependency = True)
npm.npm_translate_lock(
name = "npm",
pnpm_lock = "//:pnpm-lock.yaml",
verify_node_modules_ignored = "//:.bazelignore",
)
use_repo(npm, "npm")
Using WORKSPACE
Paste this snippet into your WORKSPACE
file:
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
http_archive(
name = "aspect_rules_js",
sha256 = "edc7b0255114fafdbbd593ea5d5fdfd54b2a603f33b3a49518910ac618e1bf2b",
strip_prefix = "rules_js-1.38.0",
url = "https://github.com/aspect-build/rules_js/releases/download/v1.38.0/rules_js-v1.38.0.tar.gz",
)
load("@aspect_rules_js//js:repositories.bzl", "rules_js_dependencies")
rules_js_dependencies()
load("@rules_nodejs//nodejs:repositories.bzl", "DEFAULT_NODE_VERSION", "nodejs_register_toolchains")
nodejs_register_toolchains(
name = "nodejs",
node_version = DEFAULT_NODE_VERSION,
)
# For convenience, npm_translate_lock does this call automatically.
# Uncomment if you don't call npm_translate_lock at all.
#load("@bazel_features//:deps.bzl", "bazel_features_deps")
#bazel_features_deps()
load("@aspect_rules_js//npm:repositories.bzl", "npm_translate_lock")
npm_translate_lock(
name = "npm",
pnpm_lock = "//:pnpm-lock.yaml",
verify_node_modules_ignored = "//:.bazelignore",
)
load("@npm//:repositories.bzl", "npm_repositories")
npm_repositories()
To use rules_js with bazel-lib 2.x, you must additionally register the coreutils toolchain.
load("@aspect_bazel_lib//lib:repositories.bzl", "register_coreutils_toolchains")
register_coreutils_toolchains()
What's Changed
- chore: upgrade to Aspect Workflows 5.9.0-rc.19 by @gregmagolan in #1464
- chore: BCR testing on Bazel 6 and 7 by @alexeagle in #1466
- chore: upgrade to Aspect Workflows 5.9.0 by @gregmagolan in #1468
- chore: add latest pnpm version by @oikarinen in #1465
- chore: upgrade to Aspect Workflows 5.9.1 by @gregmagolan in #1470
- chore: upgrade to Aspect Workflows 5.9.2 by @gregmagolan in #1471
- chore: upgrade to Bazel 7.0.2 by @gregmagolan in #1472
- chore: remove gofmt by @alexeagle in #1475
- chore: upgrade to Aspect Workflows 5.9.4 by @gregmagolan in #1476
- chore: upgrade to Aspect Workflows 5.9.5 by @gregmagolan in #1477
- chore: update always_delivery to auto_delivery by @gregmagolan in #1478
- chore: upgrade to Aspect Worklfows 5.9.9 by @gregmagolan in #1484
- chore: set reaper_sleep_minutes on reaper lambda to reduce Buildkite API calls by @gregmagolan in #1485
- feat: add replace_packages to npm_translate_lock by @gregmagolan in #1481
- chore: update pnpm versions.bzl by @jbedard in #1490
- feat: add lifecycle_hooks_use_default_shell_env to npm lifecycle hooks by @jbedard in #1489
New Contributors
- @oikarinen made their first contribution in #1465
Full Changelog: v1.37.1...v1.38.0