Npm-side config for suppressing update notifier


(Kat Marchán) #1

Continuing the discussion from Can the upgrade prompt be disabled from .npmrc?:

I think it would be really nice to have a config for this. I don’t think it needs a whole RFC and it would be a really nice starter issue. Please post here if you’re interested and if you have any questions about how to do this!

Question: RFCs and Minor Changes
(Matt Travi) #2

i would be open to submitting a PR for this. could you point me in the direction of what would be involved in making it work?

(Kat Marchán) #3

The gist of it:

  1. Look in lib/config/defaults.js and add the desired config var to both the types and defaults objects

  2. Add a documentation entry for the new config in doc/misc/ (alphabetical order, follow the format of the surrounding entries)

  3. Go to bin/npm-cli.js and find where update-notifier is loaded, and add the necessary code

I feel like writing tests for this would be excessive amounts of effort for a relatively straightforward addition, so I’m personally fine without that.

(Matt Travi) #4

do you have a preference about the name of the var? seems like there could be value in matching the cli flag --no-update-notifier, but the negation seems less than ideal in a config file. maybe we just drop the no-? i’m also open to alternatives if something else makes more sense.

(Kat Marchán) #5

If you make it update-notifier, npm will automatically support --no-update-notifier, --update-notifier=false, and any npmrc configs as such. The config parser handles negation for you :slight_smile:

(Matt Travi) #6

perfect. i’ll go with that

(Matt Travi) #7

Can the upgrade prompt be disabled from .npmrc?