Skip to content

Commit 07dba2a

Browse files
devversionjosephperrott
authored andcommitted
build: allow for @devinfra// to be used in downstream repos (#2623)
Currently when trying to import `@devinfra//` in a workspace that doesn't use `rules_nodejs` anymore, we will surface errors. This is because the top-level BUILD target/package is loaded for the shared tsconfig defaults, while this Bzl package imports from `defaults.bzl` which inherently triggers various load statements for `rules_nodejs`. This shouldn't be the case, and this commit fixes this. PR Close #2623
1 parent b3240b0 commit 07dba2a

File tree

2 files changed

+2
-18
lines changed

2 files changed

+2
-18
lines changed

BUILD.bazel

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
load("@aspect_rules_ts//ts:defs.bzl", rules_js_tsconfig = "ts_config")
22
load("@build_bazel_rules_nodejs//:index.bzl", "nodejs_binary")
33
load("@npm//@bazel/typescript:index.bzl", "ts_config")
4+
load("@build_bazel_rules_nodejs//:index.bzl", "pkg_npm")
45

56
# BEGIN-INTERNAL
67
load("//:package.bzl", "NPM_PACKAGE_SUBSTITUTIONS")
7-
load("//tools:defaults.bzl", "pkg_npm")
88

99
rules_js_tsconfig(
1010
name = "rjs-tsconfig",

tools/defaults.bzl

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -75,25 +75,9 @@ def ts_library(name, testonly = False, deps = [], srcs = [], devmode_module = No
7575
**kwargs
7676
)
7777

78-
def pkg_npm(build_package_json_from_template = False, deps = [], **kwargs):
78+
def pkg_npm(deps = [], **kwargs):
7979
_assert_defaults_allowed_for_caller()
8080

81-
if build_package_json_from_template:
82-
native.genrule(
83-
name = "package-json",
84-
srcs = [
85-
"package.json.tmpl",
86-
"//:package.json",
87-
],
88-
outs = ["package.json"],
89-
cmd = """
90-
$(execpath //tools:inline-package-json-deps) $(execpath package.json.tmpl) \
91-
$(execpath //:package.json) $@
92-
""",
93-
tools = ["//tools:inline-package-json-deps"],
94-
)
95-
deps.append("package-json")
96-
9781
_pkg_npm(
9882
deps = deps,
9983
**kwargs

0 commit comments

Comments
 (0)