MCPcopy
hub / github.com/vercel/hyper / _checkUpdate

Method _checkUpdate

bin/yarn-standalone.js:7421–7457  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

7419 }
7420
7421 _checkUpdate() {
7422 var _this13 = this;
7423
7424 return (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* () {
7425 let latestVersion = yield _this13.config.requestManager.request({
7426 url: (_constants || _load_constants()).SELF_UPDATE_VERSION_URL
7427 });
7428 invariant(typeof latestVersion === 'string', 'expected string');
7429 latestVersion = latestVersion.trim();
7430 if (!semver.valid(latestVersion)) {
7431 return;
7432 }
7433
7434 // ensure we only check for updates periodically
7435 _this13.config.registries.yarn.saveHomeConfig({
7436 lastUpdateCheck: Date.now()
7437 });
7438
7439 if (semver.gt(latestVersion, (_yarnVersion || _load_yarnVersion()).version)) {
7440 const installationMethod = yield (0, (_yarnVersion || _load_yarnVersion()).getInstallationMethod)();
7441 _this13.maybeOutputUpdate = function () {
7442 _this13.reporter.warn(_this13.reporter.lang('yarnOutdated', latestVersion, (_yarnVersion || _load_yarnVersion()).version));
7443
7444 const command = getUpdateCommand(installationMethod);
7445 if (command) {
7446 _this13.reporter.info(_this13.reporter.lang('yarnOutdatedCommand'));
7447 _this13.reporter.command(command);
7448 } else {
7449 const installer = getUpdateInstaller(installationMethod);
7450 if (installer) {
7451 _this13.reporter.info(_this13.reporter.lang('yarnOutdatedInstaller', installer));
7452 }
7453 }
7454 };
7455 }
7456 })();
7457 }
7458
7459 /**
7460 * Method to override with a possible upgrade message.

Callers 1

checkUpdateMethod · 0.95

Calls 12

_load_asyncToGeneratorFunction · 0.85
_load_constantsFunction · 0.85
invariantFunction · 0.85
_load_yarnVersionFunction · 0.85
getUpdateCommandFunction · 0.85
getUpdateInstallerFunction · 0.85
requestMethod · 0.45
saveHomeConfigMethod · 0.45
warnMethod · 0.45
langMethod · 0.45
infoMethod · 0.45
commandMethod · 0.45

Tested by

no test coverage detected