v1.36.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.36.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 = "0fd06280b6b4982e2fd94be383ac35533ac756ddf34271e1344af0a7ebaafa89",
strip_prefix = "rules_js-1.36.0",
url = "https://github.com/aspect-build/rules_js/releases/download/v1.36.0/rules_js-v1.36.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: update GHA ci.yml with improved matrix pattern by @gregmagolan in #1432
- chore: upgrade to Bazel 7.0.0 with Bazel 6 as secondary on CI by @gregmagolan in #1431
- chore: bring in Aspect bazelrc presets by @gregmagolan in #1437
- chore: update link to docsite by @gregmagolan in #1439
- chore: disable bzlmod lockfile by @gregmagolan in #1440
- chore: upgrade to Aspect Workflows 5.9.0-rc.15 by @gregmagolan in #1442
- Make sure that auth is respected, even if lockfiles have ports by @mishazharov in #1444
- refactor: do not generate unused lifecycle npm_package_store targets by @jbedard in #1402
- refactor: remove dependency on internal /pkg npm target by @jbedard in #1400
- test: move patch tests to e2e/verify-patches by @jbedard in #1401
- refactor: simplify pnpm parse_pnpm_name util by @jbedard in #1424
- chore(deps): update dependency bazel_skylib to v1.5.0 by @renovate in #1368
- chore(deps): update dependency bazel_skylib_gazelle_plugin to v1.5.0 by @renovate in #1417
- fix: include npm and yarn lock files in npm_translate_lock(data) by @jbedard in #1446
- fix: accept pnpm pkg resolution without tarball by @jbedard in #1438
- chore: reduce size of remote cache to tune deployment costs by @gregmagolan in #1449
- fix: exit with message when pnpm-lock.yaml updated in bzlmod by @jbedard in #1447
- chore: disable bzlmod lock file throughout by @gregmagolan in #1450
- feat: add special handling to js_run_devserver for 1p deps to improve watch mode performance by @gregmagolan in #1411
New Contributors
- @mishazharov made their first contribution in #1444
Full Changelog: v1.35.0...v1.36.0