npm Community Forum (Archive)

The npm community forum has been discontinued.

To discuss usage of npm, visit the GitHub Support Community.

Npm-side config for suppressing update notifier

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!

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?

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.

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.

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:

perfect. i’ll go with that