Skip to content

Commit a9257b6

Browse files
authored
Fix npm bzlmod (#8506)
* Restrict visibility of exported file * Align npm_translate_lock attrs * Remove defs_bzl_filename attr * Align root_package with pnpm-lock.yaml location Use a symlink to avoid copying the file.
1 parent fceafd4 commit a9257b6

File tree

5 files changed

+7
-4
lines changed

5 files changed

+7
-4
lines changed

MODULE.bazel

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,10 @@ npm = use_extension("@aspect_rules_js//npm:extensions.bzl", "npm")
5757
npm.npm_translate_lock(
5858
name = "flatbuffers_npm",
5959
npmrc = "//:.npmrc",
60-
pnpm_lock = "//:pnpm-lock.yaml",
60+
pnpm_lock = "//ts:pnpm-lock.yaml",
61+
# Override the Bazel package where pnpm-lock.yaml is located and link
62+
# to the specified package instead.
63+
root_package = "ts",
6164
verify_node_modules_ignored = "//:.bazelignore",
6265
)
6366
use_repo(npm, "flatbuffers_npm")

reflection/BUILD.bazel

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ filegroup(
1010
# flatbuffer_ts_library() only supports .fbs file but not filegroups
1111
exports_files(
1212
srcs = ["reflection.fbs"],
13-
visibility = ["//visibility:public"],
13+
visibility = ["//reflection/ts:__pkg__"],
1414
)
1515

1616
filegroup(

ts/BUILD.bazel

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
load("@aspect_rules_js//npm:defs.bzl", "npm_package")
22
load("@aspect_rules_ts//ts:defs.bzl", "ts_project")
3-
load("@flatbuffers_npm//:npm_link_all_packages.bzl", "npm_link_all_packages")
3+
load("@flatbuffers_npm//:defs.bzl", "npm_link_all_packages")
44

55
filegroup(
66
name = "distribution",

ts/pnpm-lock.yaml

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ts/repositories.bzl

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ def flatbuffers_npm(name):
1616
# $ bazel run -- @pnpm//:pnpm --dir $PWD install --lockfile-only
1717
update_pnpm_lock = False,
1818
verify_node_modules_ignored = "@com_github_google_flatbuffers//:.bazelignore",
19-
defs_bzl_filename = "npm_link_all_packages.bzl",
2019
data = [
2120
"@com_github_google_flatbuffers//:package.json",
2221
],

0 commit comments

Comments
 (0)