Skip to content

v2.1.3

Latest
Compare
Choose a tag to compare
@github-actions github-actions released this 23 Jan 23:22
f99b070

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.3")

####### 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 = "875b8d01af629dbf626eddc5cf239c9f0da20330f4d99ad956afc961096448dd",
    strip_prefix = "rules_js-2.1.3",
    url = "https://github.com/aspect-build/rules_js/releases/download/v2.1.3/rules_js-v2.1.3.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 #2023
  • Changes by create-pull-request action by @github-actions in #2030
  • test: add e2e/runfiles bazelversion by @jbedard in #2045
  • fix: include _repo_mapping in runfiles dir by @jfirebaugh in #2041
  • test: override bazel-lib in e2e/bzlmod to include windows fix by @jbedard in #2052
  • fix: cleanup js_run_devserver directory on SIGINT by @jbedard in #2046
  • chore: cleanup Workflows config by @gregmagolan in #2054
  • fix: override the locale when running bsdtar actions by @alexeagle in #2044
  • Changes by create-pull-request action by @github-actions in #2049
  • Add patch_tool argument to npm_translate_lock by @MichaelMitchell-at in #2048
  • chore: enable Aspect Workflows RBE by @gregmagolan in #2064
  • fix(npm): support workspace run_lifecycle_hooks=False by @jbedard in #2063
  • refactor: reduce unnecessary npm_translate_lock loop iterations by @jbedard in #2036
  • fix(npm): support pnpm v9.7+ patches without version specifier by @jbedard in #2059
  • test: add repositories.bzl snapshot tests for each lockfile version by @jbedard in #2057
  • test: demonstrate dev dependencies between workspace projects by @jbedard in #2056
  • refactor: reduce runtime string format calls, use local target paths by @jbedard in #2037
  • fix(npm): correct use of pnpm lockfile dev flag by @jbedard in #2065
  • chore: add comments/docs for pnpm lockfile fields by @jbedard in #2060
  • chore: update bcr maintainer info by @kormide in #2069
  • docs: add troubleshooting note and example of using node_options for nicer stack traces by @jbedard in #2072
  • fix(npm): use bazel 8 rctx.watch for pnpm-lock by @Mivr in #2074
  • docs: fix typo in lifecycle hook docs by @psalaberria002 in #2076

New Contributors

Full Changelog: v2.1.2...v2.1.3