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

refactor(bazel 8): point out ignore_directories function #2053

Merged
merged 1 commit into from
Feb 6, 2025
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
5 changes: 4 additions & 1 deletion docs/pnpm.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,10 @@ npm_translate_lock(
# Creates a new repository named "@npm" - you could choose any name you like
name = "npm",
pnpm_lock = "//:pnpm-lock.yaml",
# Recommended attribute that also checks the .bazelignore file
# Bazel 7.x and earlier: this attribute checks the .bazelignore file covers all node_modules folders.
# Bazel 8.0 can use https://bazel.build/rules/lib/globals/repo#ignore_directories:
# ignore_directories(["**/node_modules"])
# in REPO.bazel
verify_node_modules_ignored = "//:.bazelignore",
)
```
Expand Down
7 changes: 4 additions & 3 deletions npm/private/npm_translate_lock_helpers.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -529,11 +529,12 @@ pnpm install will create nested node_modules, but not all of them are ignored by
We recommend that all node_modules folders in the source tree be ignored,
to avoid Bazel printing confusing error messages.

Either add line(s) to {bazelignore}:
Possible fixes:
- Upgrade to Bazel 8.0 and use ignore_directories(["**/node_modules"]) in REPO.bazel
- Disable this check by removing `verify_node_modules_ignored` in `npm_translate_lock(name = "{repo}")`
- Add line(s) to {bazelignore}:

{fixes}

or disable this check by setting `verify_node_modules_ignored = None` in `npm_translate_lock(name = "{repo}")`
""".format(
fixes = "\n".join(missing_ignores),
bazelignore = rctx.attr.verify_node_modules_ignored,
Expand Down
Loading