v2.0.0-rc2
Important
See #1671 for list of BREAKING CHANGES in rules_js 2.0. We'll copy over the list of BREAKING CHANGES to these release notes soon.
Downstream rulesets will also require updates to their latest RCs along with this upgrade:
https://github.com/aspect-build/rules_cypress/releases/tag/v0.6.0-rc0
https://github.com/aspect-build/rules_esbuild/releases/tag/v0.21.0-rc0
https://github.com/aspect-build/rules_jasmine/releases/tag/v2.0.0-rc0
https://github.com/aspect-build/rules_jest/releases/tag/v0.22.0-rc0
https://github.com/aspect-build/rules_rollup/releases/tag/v2.0.0-rc0
https://github.com/aspect-build/rules_swc/releases/tag/v2.0.0-rc0
https://github.com/aspect-build/rules_ts/releases/tag/v3.0.0-rc0
https://github.com/aspect-build/rules_webpack/releases/tag/v0.16.0-rc0
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.0.0-rc2")
####### 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.1.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 = "25e06ac98ce2dd44d74e728e63e1c88e707d0972db20d7e7339c8e458335b4e3",
strip_prefix = "rules_js-2.0.0-rc2",
url = "https://github.com/aspect-build/rules_js/releases/download/v2.0.0-rc2/rules_js-v2.0.0-rc2.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: bump miminum dep to aspect_bazel_lib 2.7.6 by @gregmagolan in #1755
- refactor: simplify handling of #423, package aliases by @jbedard in #1757
- refactor: move npm_registry_url to utils by @jbedard in #1758
- refactor: do not include registry url in package keys by @jbedard in #1759
- feat: add include_npm_sources to npm_package by @gregmagolan in #1760
- docs: update section on "Exec failed due to IOException" by @fmeum in #1761
- fix: include package store directory in default output of npm_link_package_store by @gregmagolan in #1762
- chore: bump minimum aspect_bazel_lib to 2.7.7 by @gregmagolan in #1763
- test: add lockfile test cases by @jbedard in #1764
- chore: automate pnpm version mirroring by @alexeagle in #1766
- fix(pnpm): support pnpm9 URL, github version package versions by @jbedard in #1765
- fix(pnpm): support npm: alias dependencies with pnpm lockfile v5 by @jbedard in #1767
- chore: bump to rules_oci 1.7.6 by @gregmagolan in #1768
- refactor: sort generated npm_translate_lock store targets by @jbedard in #1769
- fix(pnpm): support npm: aliases to packages in alternate registries by @jbedard in #1770
New Contributors
Full Changelog: v2.0.0-rc1...v2.0.0-rc2