From 99d0900c26eaf4241c18d29b9fcba86a054f261b Mon Sep 17 00:00:00 2001 From: Jason Bedard Date: Sun, 18 Aug 2024 19:42:15 -0700 Subject: [PATCH] docs: add note about js_binary shell script (#1897) --- docs/js_binary.md | 4 ++++ js/private/js_binary.bzl | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/docs/js_binary.md b/docs/js_binary.md index 7d512f0af..b4f65d17f 100644 --- a/docs/js_binary.md +++ b/docs/js_binary.md @@ -39,6 +39,10 @@ Bazel option to see more detail about the selection. All [common binary attributes](https://bazel.build/reference/be/common-definitions#common-attributes-binaries) are supported including `args` as the list of arguments passed Node.js. +Node.js execution is performed by a shell script that sets environment variables and runs the Node.js binary with the `entry_point` script. +The shell script is located relative to the directory containing the `js_binary` at `\{name\}_/\{name\}` similar to other rulesets +such as rules_go. See [PR #1690](https://github.com/aspect-build/rules_js/pull/1690) for more information on this naming scheme. + The following environment variables are made available to the Node.js runtime based on available Bazel [Make variables](https://bazel.build/reference/be/make-variables#predefined_variables): * JS_BINARY__BINDIR: the WORKSPACE-relative Bazel bin directory; equivalent to the `$(BINDIR)` Make variable of the `js_binary` target diff --git a/js/private/js_binary.bzl b/js/private/js_binary.bzl index 5baa777d7..33e71d92a 100644 --- a/js/private/js_binary.bzl +++ b/js/private/js_binary.bzl @@ -33,6 +33,10 @@ Bazel option to see more detail about the selection. All [common binary attributes](https://bazel.build/reference/be/common-definitions#common-attributes-binaries) are supported including `args` as the list of arguments passed Node.js. +Node.js execution is performed by a shell script that sets environment variables and runs the Node.js binary with the `entry_point` script. +The shell script is located relative to the directory containing the `js_binary` at `\\{name\\}_/\\{name\\}` similar to other rulesets +such as rules_go. See [PR #1690](https://github.com/aspect-build/rules_js/pull/1690) for more information on this naming scheme. + The following environment variables are made available to the Node.js runtime based on available Bazel [Make variables](https://bazel.build/reference/be/make-variables#predefined_variables): * JS_BINARY__BINDIR: the WORKSPACE-relative Bazel bin directory; equivalent to the `$(BINDIR)` Make variable of the `js_binary` target