Skip to content

Commit

Permalink
Fix npm bzlmod (#8506)
Browse files Browse the repository at this point in the history
* 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.
  • Loading branch information
mering authored Jan 23, 2025
1 parent fceafd4 commit a9257b6
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 4 deletions.
5 changes: 4 additions & 1 deletion MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,10 @@ npm = use_extension("@aspect_rules_js//npm:extensions.bzl", "npm")
npm.npm_translate_lock(
name = "flatbuffers_npm",
npmrc = "//:.npmrc",
pnpm_lock = "//:pnpm-lock.yaml",
pnpm_lock = "//ts:pnpm-lock.yaml",
# Override the Bazel package where pnpm-lock.yaml is located and link
# to the specified package instead.
root_package = "ts",
verify_node_modules_ignored = "//:.bazelignore",
)
use_repo(npm, "flatbuffers_npm")
Expand Down
2 changes: 1 addition & 1 deletion reflection/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ filegroup(
# flatbuffer_ts_library() only supports .fbs file but not filegroups
exports_files(
srcs = ["reflection.fbs"],
visibility = ["//visibility:public"],
visibility = ["//reflection/ts:__pkg__"],
)

filegroup(
Expand Down
2 changes: 1 addition & 1 deletion ts/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
load("@aspect_rules_js//npm:defs.bzl", "npm_package")
load("@aspect_rules_ts//ts:defs.bzl", "ts_project")
load("@flatbuffers_npm//:npm_link_all_packages.bzl", "npm_link_all_packages")
load("@flatbuffers_npm//:defs.bzl", "npm_link_all_packages")

filegroup(
name = "distribution",
Expand Down
1 change: 1 addition & 0 deletions ts/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion ts/repositories.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ def flatbuffers_npm(name):
# $ bazel run -- @pnpm//:pnpm --dir $PWD install --lockfile-only
update_pnpm_lock = False,
verify_node_modules_ignored = "@com_github_google_flatbuffers//:.bazelignore",
defs_bzl_filename = "npm_link_all_packages.bzl",
data = [
"@com_github_google_flatbuffers//:package.json",
],
Expand Down

0 comments on commit a9257b6

Please sign in to comment.