Skip to content

Commit

Permalink
fix: include package store directory in default output of npm_link_pa…
Browse files Browse the repository at this point in the history
…ckage_store
  • Loading branch information
gregmagolan committed May 28, 2024
1 parent 31118a6 commit 2517a35
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 5 deletions.
3 changes: 0 additions & 3 deletions examples/genrule/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,6 @@ genrule(
name = "call_acorn",
srcs = [
":one.js",
# reference the location where the "acorn" npm package was linked in our root Bazel package.
"//:node_modules/acorn",
"//:node_modules/acorn/dir",
],
outs = ["out1"],
Expand Down Expand Up @@ -69,7 +67,6 @@ genrule(
":require_acorn_js",
# reference the location where the "acorn" npm package was linked in our root Bazel package.
"//:node_modules/acorn",
"//:node_modules/acorn/dir",
],
outs = ["out2"],
cmd = """
Expand Down
2 changes: 1 addition & 1 deletion npm/private/npm_link_package_store.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ def _npm_link_package_store_impl(ctx):
)
files.append(bin_file)

files_depset = depset(files)
files_depset = depset(files, transitive = [store_info.files])

transitive_files_depset = depset(files, transitive = [store_info.transitive_files])

Expand Down
20 changes: 19 additions & 1 deletion npm/private/test/npm_package/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,19 @@ js_library(

npm_package(
name = "pkg",
srcs = [":lib_a"],
srcs = [
":lib_a",
],
visibility = ["//visibility:public"],
)

npm_package(
name = "pkg_2",
srcs = [
":lib_a",
":node_modules/chalk", # should be excluded
"//:node_modules/chalk", # should be excluded
],
visibility = ["//visibility:public"],
)

Expand All @@ -39,3 +51,9 @@ diff_test(
file1 = ":pkg",
file2 = ":expected_pkg",
)

diff_test(
name = "test_2",
file1 = ":pkg_2",
file2 = ":expected_pkg",
)

0 comments on commit 2517a35

Please sign in to comment.