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.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 = "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 = "75c25a0f15a9e4592bbda45b57aa089e4bf17f9176fd735351e8c6444df87b52",
strip_prefix = "rules_js-2.1.0",
url = "https://github.com/aspect-build/rules_js/releases/download/v2.1.0/rules_js-v2.1.0.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
- Changes by create-pull-request action by @github-actions in #1922
- chore(deps): update webfactory/ssh-agent action to v0.9.0 by @renovate in #1634
- Add support for
+
in canonical repo names by @fmeum in #1927 - docs: Clarify that $npm_package.publish requires publishable = True by @fweikert in #1926
- chore(deps): update aspect by @renovate in #1923
- chore: restore windows testing by @alexeagle in #1920
- Changes by create-pull-request action by @github-actions in #1930
- chore: fix broken links by @alexeagle in #1931
- chore: adopt conclusion job for stable status check by @alexeagle in #1921
- test: add @bazel/runfiles test by @jbedard in #1895
- chore(deps): update bazel by @renovate in #1928
- chore(deps): update patch updates by @renovate in #1937
- chore(deps): update @types by @renovate in #1558
- chore(deps): update rollup by @renovate in #1874
- chore(deps): update dependency bazel_skylib_gazelle_plugin to v1.7.1 - autoclosed by @renovate in #1943
- chore(deps): update syncpack digest to 805e36f by @renovate in #1829
- chore(deps): update dependency rollup to v3.29.5 [security] by @renovate in #1940
- chore(deps): update dependency gazelle to v0.39.1 by @renovate in #1945
- chore(deps): update dependency buildifier_prebuilt to v7 by @renovate in #1949
- chore(deps): update peter-evans/create-pull-request action to v7 by @renovate in #1950
- chore(deps): update dependency rules_go to v0.50.1 by @renovate in #1953
- chore(deps): update dependency stardoc to v0.7.1 by @renovate in #1954
- feat(pnpm): allow
latest
as version to get the latest version by @gzm0 in #1933 - chore: disable renovate for unit test projects by @jbedard in #1960
- chore(deps): update softprops/action-gh-release action to v2 by @renovate in #1951
- Changes by create-pull-request action by @github-actions in #1965
- ci: fix matrix job on GitHub Actions by @gregmagolan in #1967
- docs: merge gather_files_from_js_infos rename PRs in migration docs by @gzm0 in #1891
- chore: bump to Aspect CLI 2024.41.17 by @gregmagolan in #1968
New Contributors
Full Changelog: v2.0.2...v2.1.0