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

[Bug]: lifecycle_hooks_exclude does not work with pnpm.neverBuiltDependencies #1913

Open
scttdavs opened this issue Sep 6, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@scttdavs
Copy link

scttdavs commented Sep 6, 2024

What happened?

I think this could be considered a feature request, but given what I needed to do to work around it, it feels more like a bug, or maybe missed requirement.

When using lifecycle_hooks_exclude with npm_translate_lock, it gets converted to the equivalent lifecycle_hooks definition under the hood. That's nice, but with pnpm v9, I now need to add pnpm.onlyBuiltDependencies. However, since this is an allow list, I now need to add every other package that has install scripts, even when I just want to exclude a few.

Pnpm has a nicer alternative when you just want to exclude and that's pnpm.neverBuiltDependencies. Rules_js doesn't check for this though, and still enforces you add onlyBuiltDependencies, which now requires us to maintain an ongoing allow list of all packages with install scripts, just so we can exclude a few.

Version

Development (host) and target OS/architectures:

Output of bazel --version: 6.5

Version of the Aspect rules, or other relevant rules from your
WORKSPACE or MODULE.bazel file: WORKSPACE

Language(s) and/or frameworks involved: JavaScript

How to reproduce

Create a JavaScript project with pnpm v9 or higher, add a package to `lifecycle_hooks_exclude` and add `pnpm.neverBuiltDependencies` with the same packages. Rules_js fails saying you must use `pnpm.onlyBuiltDependencies`.

Any other information?

No response

@scttdavs scttdavs added the bug Something isn't working label Sep 6, 2024
@jbedard
Copy link
Member

jbedard commented Sep 6, 2024

The problem is that pnpm 9+ no longer specifies what packages require a build, the requiresBuild attribute was removed.

So I think pnpm.neverBuiltDependencies is useless when we don't know which packages require a build in the first place.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants