Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: include package store directory in default output of npm_link_package_store #1762

Merged
merged 1 commit into from
May 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions examples/genrule/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,12 @@ 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"],
cmd = " ".join([
"$(NODE_PATH)",
# reference the location where the "acorn" npm package was linked in the rules_js npm package store.
"./$(execpath //:node_modules/acorn/dir)/bin/acorn",
"--compact",
"$(execpath :one.js)",
Expand Down Expand Up @@ -69,7 +68,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
17 changes: 16 additions & 1 deletion npm/private/test/npm_package/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,16 @@ npm_package(
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"],
)

copy_to_directory(
name = "expected_pkg",
srcs = [
Expand All @@ -40,6 +50,12 @@ diff_test(
file2 = ":expected_pkg",
)

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

npm_package(
name = "pkg_with_node_modules",
srcs = [":lib_a"],
Expand All @@ -53,7 +69,6 @@ copy_to_directory(
srcs = [
"index.js",
":node_modules/chalk",
":node_modules/chalk/dir",
":package.json",
],
)
Expand Down
Loading