Skip to content

Commit a5e1c9b

Browse files
authored
fix: avoid sh_binary (#2436)
Bazel 9 requires this be loaded from rules_shell, and we don't want to add another module dependency from the generated @npm repo
1 parent 197682f commit a5e1c9b

File tree

3 files changed

+5
-9
lines changed

3 files changed

+5
-9
lines changed

npm/private/BUILD.bazel

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@ js_library(
1414

1515
exports_files(glob(["*.bzl"]))
1616

17-
exports_files(["noop.sh"])
18-
1917
# We manually keep the generated rules documentation synced.
2018
# Check that the signatures stay matched.
2119
[

npm/private/noop.sh

Lines changed: 0 additions & 2 deletions
This file was deleted.

npm/private/npm_translate_lock_generate.bzl

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -69,16 +69,16 @@ def generate_repository_files(rctx, importers, packages, patched_dependencies, o
6969

7070
rctx_files = {
7171
"BUILD.bazel": [
72+
"""load("@aspect_rules_js//js:defs.bzl", "js_binary")""",
7273
"""load("@bazel_skylib//:bzl_library.bzl", "bzl_library")""",
73-
"",
74+
"""load("@bazel_skylib//rules:write_file.bzl", "write_file")""",
7475
"""
7576
# A no-op run target that can be run to invalidate the repository
7677
# to update the pnpm lockfile. Useful under bzlmod where
7778
# `bazel sync --only=repo` is a no-op.
78-
sh_binary(
79-
name = "sync",
80-
srcs = ["@aspect_rules_js//npm/private:noop.sh"],
81-
)""",
79+
write_file(name="noop", out="noop.js", content=["#!/usr/bin/env node"])
80+
js_binary(name = "sync", entry_point = "noop.js")
81+
""",
8282
"",
8383
"exports_files({})".format(starlark_codegen_utils.to_list_attr([
8484
rctx.attr.defs_bzl_filename,

0 commit comments

Comments
 (0)