feat(config): add in-range#3397
Conversation
This adds a flag for `npm outdated` to use to limit output either to packages that have updates in-range of the current package's requirements, or those that have no updates in-range of the current package's requirements. It also adds to the normal (i.e. non JSON or parseable) output directing folks to use `npm explain` for more info. This is because the output of `npm outdated` is misleading, sometimes saying an available version is present when there is another package in the tree responsible for keeping the version where it is.
35a35db to
fa92cb2
Compare
| const include = | ||
| this.npm.config.get('in-range') === null || | ||
| (this.npm.config.get('in-range') === true && wanted === latest) || | ||
| (this.npm.config.get('in-range') === false && wanted !== latest) |
There was a problem hiding this comment.
So, iiuc, "in-range" means "only show where wanted is latest". My expectation was that it would be "only show where the wanted version is within my dep range". Maybe I'm misreading this?
There was a problem hiding this comment.
So, like, if the current is 1.0.0, wanted is 1.0.1, but latest is 2.0.0, I'd expect npm outdated --in-range to show that.
There was a problem hiding this comment.
Actually, in that case, I'd also expect it to show up for npm outdated --no-in-range, because there's an out-of-range version I could install.
There was a problem hiding this comment.
I wanted a way to filter between the red and the yellow outputs in pretty print.
There was a problem hiding this comment.
Ultimately "what could I fix with npm update and what would need a package.json change?"
There was a problem hiding this comment.
My expectation was that it would be "only show where the wanted version is within my dep range
YES this is the intent. "What could I fix with npm update"
Also related: this is what I assume is being communicated by the red and yellow output colors here.
|
@ruyadorno I think I'm actually gonna close this, or move it back to draft cause the discussion seems to be warranted here about what problem(s) we're actually solving. |
| When running `npm outdated` setting `--in-range` will limit output to only | ||
| those packages with existing versions in range of the current project's | ||
| dependencies. `--no-in-range` will limit output to only those packages with | ||
| updates that are out of range of the current project's dependencies. | ||
|
|
There was a problem hiding this comment.
so with these options, how do i override NPM_CONFIG_IN_RANGE=false npm outdated (or true)? do i have to do --in-range=null?
Generally a boolean isn't a great choice when there's three options, so perhaps an enum would be clearer here?
There was a problem hiding this comment.
@ljharb see the discussion on the if statements above, it is as you say checking for the default null vs an explicit true or false. I agree it's not ideal and that discussion is why this PR went back to draft status to be discussed and solved as part of a better solution that lets npm update --dry-run solve the "What can be updated problem" first.
|
Per today's RFC call, here's my thoughts: there's really two mental models - two use cases - that i think people are using
It might be useful for the default view of |
|
The tracking issue for 'make reify dry run things good' is here #1999 |
|
Closing: we are going to queue up |
|
@darcyclarke Does that solve #3409, which was closed in favour of this PR? |
|
Yes this will fall under that same umbrella. |
This adds a flag for
npm outdatedto use to limit output either topackages that have updates in-range of the current package's
requirements, or those that have no updates in-range of the current
package's requirements.
It also adds to the normal (i.e. non JSON or parseable) output directing
folks to use
npm explainfor more info. This is because the output ofnpm outdatedis misleading, sometimes saying an available version ispresent when there is another package in the tree responsible for
keeping the version where it is.