pnpm ls only lists top-level dependencies by default but it should list all subdependencies as well #11162 #15978
Replies: 6 comments
|
Hi! I’d like to work on this issue. Could you please assign it to me? I’ll make sure to follow the contribution guidelines. Thanks! |
|
Don't think I have the authority, and also I think it's a good idea to wait for a maintainer to confirm this as work to be done. |
|
In the linked in discussion you already got an answer that with pnpm you can use |
|
Yes, but it's not obvious at all in the docs or manpage that As an aside, using |
|
Pinging because this is exactly what we need for the current tanstack mini-Shai-Hulud situation. |
|
My notes on confusion with this: The help information (
Me: "great, it lists everything" Granted some ambiguity in "all dependencies" vs "all direct dependencies not including sub-dependencies" or "all dependencies including sub-dependencies". But I agree with @starkipraggy on the semantics of list vs why. Vulnerability checking was my reason for digging into the exact behaviour. |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Contribution
Describe the user story
Issue version of [this]:(https://github.com/orgs/pnpm/discussions/11162#)
The docs say (emphasis mine):
But it doesn't actually do that unless you specify
--depth=Infinity.I use
pnpm lslikenpm lsexpecting that the command will list all subdependencies. This is especially important in situations where you are looking for whether you have a specific package in your subdependencies for security checks. (pnpm auditisn't updated fast enough for situations like the recent axios debacle)I understand that bigger repositories might have performance problems with having all dependencies recursively listed by default.
My stance is the big repository usecase should be the one where you have to specify
--depthbecause it's different for everyone.The failure case for performance problems is to simply
Ctrl-Cor at the very worst, turn the machine on and off again.The failure case for not showing subdependencies when they're trusted to be shown is a security breach.
I accept that
pnpm lsmay in fact be the wrong tool for the job. However the expectation is thatpnpm lsbehaves likenpm lsor evenyarn listand creates a greppable package tree. In that casepnpm lsdocs should point users topnpm whyfor the purpose of finding if a package exists in the dependency tree.Describe the solution you'd like
Update
pnpm lsdocs to point topnpm whyfor the purpose of finding if a package exists in the dependency tree.Describe the drawbacks of your solution
Requires reading comprehension on behalf of the userThe core problem is retraining developers to not use<npm equivalent> lsand instinctively reach forpnpm whywhich this issue does not fundamentally solve (at least not immediately)Describe alternatives you've considered
Make
pnpm ls=pnpm ls --depth=Infinityby default.whywhen you havels?)All reactions