* Check for updates every day and output a nag message if there's a newer version.
()
| 7392 | */ |
| 7393 | |
| 7394 | checkUpdate() { |
| 7395 | if (this.config.nonInteractive) { |
| 7396 | // don't show upgrade dialog on CI or non-TTY terminals |
| 7397 | return; |
| 7398 | } |
| 7399 | |
| 7400 | // don't check if disabled |
| 7401 | if (this.config.getOption('disable-self-update-check')) { |
| 7402 | return; |
| 7403 | } |
| 7404 | |
| 7405 | // only check for updates once a day |
| 7406 | const lastUpdateCheck = Number(this.config.getOption('lastUpdateCheck')) || 0; |
| 7407 | if (lastUpdateCheck && Date.now() - lastUpdateCheck < ONE_DAY) { |
| 7408 | return; |
| 7409 | } |
| 7410 | |
| 7411 | // don't bug for updates on tagged releases |
| 7412 | if ((_yarnVersion || _load_yarnVersion()).version.indexOf('-') >= 0) { |
| 7413 | return; |
| 7414 | } |
| 7415 | |
| 7416 | this._checkUpdate().catch(() => { |
| 7417 | // swallow errors |
| 7418 | }); |
| 7419 | } |
| 7420 | |
| 7421 | _checkUpdate() { |
| 7422 | var _this13 = this; |
no test coverage detected