v2.1.1
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 = "2.1.1")
####### 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 = "6.3.0")
node = use_extension("@rules_nodejs//nodejs:extensions.bzl", "node", dev_dependency = True)
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")
pnpm = use_extension("@aspect_rules_js//npm:extensions.bzl", "pnpm")
# Allows developers to use the matching pnpm version, for example:
# bazel run -- @pnpm --dir /home/runner/work/rules_js/rules_js install
use_repo(pnpm, "pnpm")
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 = "3388abe9b9728ef68ea8d8301f932b11b2c9a271d74741ddd5f3b34d1db843ac",
strip_prefix = "rules_js-2.1.1",
url = "https://github.com/aspect-build/rules_js/releases/download/v2.1.1/rules_js-v2.1.1.tar.gz",
)
load("@aspect_rules_js//js:repositories.bzl", "rules_js_dependencies")
rules_js_dependencies()
load("@aspect_rules_js//js:toolchains.bzl", "DEFAULT_NODE_VERSION", "rules_js_register_toolchains")
rules_js_register_toolchains(node_version = DEFAULT_NODE_VERSION)
load("@aspect_rules_js//npm:repositories.bzl", "npm_translate_lock")
npm_translate_lock(
name = "npm",
npmrc = "//:.npmrc",
pnpm_lock = "//:pnpm-lock.yaml",
verify_node_modules_ignored = "//:.bazelignore",
)
load("@npm//:repositories.bzl", "npm_repositories")
npm_repositories()
What's Changed
- chore: fix workspace js image tests by @jbedard in #1970
- docs: rules_js 2.x migration guide moved to docsite by @gregmagolan in #1975
- chore: update refs to bazel-lib which moved to bazel-contrib by @gregmagolan in #1976
- fix(npm): support patches, lifecycle hooks for non-directory file: packages by @jbedard in #1980
- build: disable aspect_bazelrc_presets tests in non-bzlmod by @jbedard in #1982
- fix(npm): package file: versions not relative to the workspace root by @jbedard in #1981
- fix: upgrade bazel-lib to include run_binary param parsing fix by @jbedard in #1987
- build: do not run e2e/runfiles on non-bzlmod by @jbedard in #1986
- Changes by create-pull-request action by @github-actions in #1990
- chore: enable bazel6 ci tests by @jbedard in #1988
- chore: upgrade bazel to v7.3.2 by @gregmagolan in #1969
- refactor(npm): replace truthy value in set with True by @jbedard in #1992
- build: only run bazel 6 unit tests with bzlmod by @jbedard in #1994
- docs(js_run_devserver): add note about ibazel issue 100 by @jbedard in #2000
- Changes by create-pull-request action by @github-actions in #2003
- perf(npm): reduce use of .keys() for has-entry check by @jbedard in #2006
- chore(deps): update dependency bazel to v7.4.0 by @renovate in #1939
- fix(js_run_devserver): ensure files are synced before waiting for next build event by @jbedard in #1999
- fix(npm): add missing patch copy action key by @jbedard in #2008
- refactor(npm): add validation of parsed pnpm-lock data by @jbedard in #1979
- chore: update ci to bazel 7.4 by @jbedard in #2010
- docs: document exclude_types_from_npm_packages as deprecated by @jbedard in #2014
- fix: include repo mapping in the sources by @thesayyn in #2011
- perf(js_run_devserver): run fs delete operations in parallel by @jbedard in #2001
- docs: update troubleshooting reference by @emmanuel-ferdman in #2016
- chore: fix broken link by @alexeagle in #2022
- Changes by create-pull-request action by @github-actions in #2018
New Contributors
- @emmanuel-ferdman made their first contribution in #2016
Full Changelog: v2.1.0...v2.1.1