Fix for #16083, add support for --silent flag with npm outdated.#16703
Fix for #16083, add support for --silent flag with npm outdated.#16703wwalser wants to merge 1 commit intonpm:latestfrom
Conversation
|
+1 on this. This is what I expected, but I missed it at the last PR. We need to update
|
|
As it stands, this breaks the |
|
@kenany Perhaps I'm misunderstanding the use of Before opening the PR, I checked to be sure that It looks like Here is an example run of |
|
Sorry, I should've provided an example. Let's say I've configured my global loglevel=httpWithout this patch: $ npm install object-assign
# get `loglevel=http` output
$ npm install --silent object-assign
# get `loglevel=silent` outputWith this patch: $ npm install object-assign
# get `loglevel=http` output
$ npm install --silent object-assign
# still get `loglevel=http` output, instead of `loglevel=silent` output |
|
Thanks for those details but what you're describing is not the case, see the gif below. This doesn't actually break that feature. It just changes the return code to match what was described in #14013. I mentioned my hesitation with the overlapping flag in my OP. Is that what you're describing? Here I show a run with an Checking the log level would work from a code perspective but since loglevel is an orthogonal feature, checking the config makes more sense. It makes what is happening, a configuration parameter specific to My recommendation, from the OP, is that we change the config parameter's name. This avoids the confusion caused by using |
|
Okay, so oddly enough, this doesn't break the feature I mentioned for |
|
@kenany You're right. I'm not sure why the same doesn't happen for outdated, but this does cause issues for other commands. I haven't read enough of the code to tell why exactly. It makes sense that having something that is both a parameter and a shorthand causes a collision but why it functions properly for |
|
@wwalser This patch is breaking things because |
|
@iarna Yes, that's discussed in the comments here, in the bug, and in the original change that introduced the bug. My proposed solution is to rename the flag or drop this fix and accept the knock on regressions. I'm happy with any decision. The bug this caused for me has been fixed down stream by ignoring the exit code. |
|
Hi! We're moving repos to https://github.com/npm/cli/pulls! See our blog post about the migration to npm.community for details. As such, we're closing all active PRs on this repo. Could you please re-open this PR against |


Fix for #16083 which is a bug introduced in #14013.
This PR is a strict fix for what was said to be the intended behavior introduced in #14013.
npm outdated --silentwas suppose to maintain the old behavior of returning a success status code even if wanted or latest were out of date.As an aside, this seems to me like the wrong implementation. It introduces a second meaning of the word "silent" and it may even clash with existing behavior, though I couldn't find an invocation where this was the case.
It seems to me that reusing silent is problematic. The real desire, I believe, is to be able to use
npm outdatedwith some nuance. For example see facebook/fbjs/issues/213, where an out of date "wanted" may be a reasonable case for an error but "latest" may not be.Edit: As @kenany correctly points out, the collision of a command config option and loglevel shorthand causes problems. I suggest either dumping this feature and letting downstream consumers sort out the exit code for themselves or creating a new option to
npm outdatedwith name other than--silent. I would prefer the later and I'm willing to change the PR to make that happen. Open to suggestions for what the config option should be called,---quiet?