rfcs icon indicating copy to clipboard operation
rfcs copied to clipboard

[RRFC] include context that a module is overridden in npm ls

Open bnb opened this issue 3 years ago • 5 comments

Motivation ("The Why")

I recently spoke with someone who was trying out overrides for the first time in their product and didn't have any signal as to whether or not an override was being applied.

In them showing me, it was explained that npm ls didn't tell them anything about overrides and that feels like a large missed opportunity.

Example

  • git clone https://github.com/bnb/repro-overrides-output
  • npm install
  • npm ls --depth=3
  • find "@types/prettier" which will show 2.6.0 without any indication that it was overridden.

How

Current Behaviour

When you npm ls, no overrides contextual information is shown.

Desired Behaviour

When you npm ls, note which modules were overridden as npm currently does with dedupes. Potentially also worth noting direct overrides vs. indirect overrides.

References

  • N/A

bnb avatar Aug 05 '22 19:08 bnb

Does npm explain provide this context, at least?

ljharb avatar Aug 05 '22 19:08 ljharb

as far as I can tell it doesn't. Here's a gist: https://gist.github.com/bnb/109d0429dd33824415e0671679ff46fb

bnb avatar Aug 05 '22 19:08 bnb

While it seems like npm ls could be an RFC (a very necessary one that probably should have been part of overrides from the start), npm explain not showing that seems like a bug.

ljharb avatar Aug 05 '22 19:08 ljharb

+1 to have some sort of info added to npm ls

not even sure if it needs a full RFC, probably useful to have a light RFC since it would be nice to have a few examples and set expectations on how things are supposed to look like / work (particularly the other visualization modes: parseable and json)

ruyadorno avatar Aug 05 '22 20:08 ruyadorno

@darcyclarke any shot we can get this included in the next meeting?

bnb avatar Aug 08 '22 22:08 bnb

this work has been done here: https://github.com/npm/cli/pull/5306

nlf avatar Aug 16 '22 18:08 nlf

sick, tysm @nlf <3

I'm not sure if you're waiting to close this until it ships, but that does solve my request. I'll close this now but feel free to reopen if that's part of your workflow.

bnb avatar Aug 17 '22 06:08 bnb