Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cli: don't run update-notifier in CI environment #33

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion bin/npm-cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,11 @@
) {
const pkg = require('../package.json')
let notifier = require('update-notifier')({pkg})
const isCI = require('ci-info').isCI
Copy link
Contributor

@iarna iarna Jul 31, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We already detect CI in a handful of places and currently ci-info doesn't entirely align. Then again, our various detectors don't align with each other. Ideally, I'd like to see those patched to use ci-info as well (but not in this PR).

For reference, our existing CI detectors are here:

'progress': !process.env.TRAVIS && !process.env.CI,

and here:

https://github.com/npm/npm-registry-fetch/blob/03dde52817d00996d8316b155832d8802f338236/config.js#L26

The latter one detects things ci-info doesn't, so ci-info will need patching before we can entirely switch over to it.

There's also:

https://github.com/npm/npm-registry-client/blob/d70399bff938b04cd3ed7052f415c6ed2d6bd275/lib/initialize.js#L15

Which should probably be patched too, though we aren't/won't be using it any more in npm proper.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

BTW: The is-ci module is just a convenience wrapper around ci-info, that when used programmatically returns a boolean and when used from the command line uses the exit code to signal if it's being run on a CI server or not.

if (
notifier.update &&
notifier.update.latest !== pkg.version
notifier.update.latest !== pkg.version &&
!isCI
) {
const color = require('ansicolors')
const useColor = npm.config.get('color')
Expand Down
2 changes: 1 addition & 1 deletion node_modules/ci-info/LICENSE

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 14 additions & 3 deletions node_modules/ci-info/README.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

33 changes: 18 additions & 15 deletions node_modules/ci-info/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

38 changes: 21 additions & 17 deletions node_modules/ci-info/package.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
"cacache": "^11.1.0",
"call-limit": "~1.1.0",
"chownr": "~1.0.1",
"ci-info": "^1.3.1",
"cli-columns": "^3.1.2",
"cli-table3": "^0.5.0",
"cmd-shim": "~2.0.2",
Expand Down Expand Up @@ -154,6 +155,7 @@
"bluebird",
"bin-links",
"chownr",
"ci-info",
"cmd-shim",
"columnify",
"config-chain",
Expand Down