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

Method bailout

bin/yarn-standalone.js:6645–6701  ·  view source on GitHub ↗
(patterns, workspaceLayout)

Source from the content-addressed store, hash-verified

6643 }
6644
6645 bailout(patterns, workspaceLayout) {
6646 var _this3 = this;
6647
6648 return (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* () {
6649 // We don't want to skip the audit - it could yield important errors
6650 if (_this3.flags.audit) {
6651 return false;
6652 }
6653 // PNP is so fast that the integrity check isn't pertinent
6654 if (_this3.config.plugnplayEnabled) {
6655 return false;
6656 }
6657 if (_this3.flags.skipIntegrityCheck || _this3.flags.force) {
6658 return false;
6659 }
6660 const lockfileCache = _this3.lockfile.cache;
6661 if (!lockfileCache) {
6662 return false;
6663 }
6664 const lockfileClean = _this3.lockfile.parseResultType === 'success';
6665 const match = yield _this3.integrityChecker.check(patterns, lockfileCache, _this3.flags, workspaceLayout);
6666 if (_this3.flags.frozenLockfile && (!lockfileClean || match.missingPatterns.length > 0)) {
6667 throw new (_errors || _load_errors()).MessageError(_this3.reporter.lang('frozenLockfileError'));
6668 }
6669
6670 const haveLockfile = yield (_fs || _load_fs()).exists(path.join(_this3.config.lockfileFolder, (_constants || _load_constants()).LOCKFILE_FILENAME));
6671
6672 const lockfileIntegrityPresent = !_this3.lockfile.hasEntriesExistWithoutIntegrity();
6673 const integrityBailout = lockfileIntegrityPresent || !_this3.config.autoAddIntegrity;
6674
6675 if (match.integrityMatches && haveLockfile && lockfileClean && integrityBailout) {
6676 _this3.reporter.success(_this3.reporter.lang('upToDate'));
6677 return true;
6678 }
6679
6680 if (match.integrityFileMissing && haveLockfile) {
6681 // Integrity file missing, force script installations
6682 _this3.scripts.setForce(true);
6683 return false;
6684 }
6685
6686 if (match.hardRefreshRequired) {
6687 // e.g. node version doesn't match, force script installations
6688 _this3.scripts.setForce(true);
6689 return false;
6690 }
6691
6692 if (!patterns.length && !match.integrityFileMissing) {
6693 _this3.reporter.success(_this3.reporter.lang('nothingToInstall'));
6694 yield _this3.createEmptyManifestFolders();
6695 yield _this3.saveLockfileAndIntegrity(patterns, workspaceLayout);
6696 return true;
6697 }
6698
6699 return false;
6700 })();
6701 }
6702

Callers

nothing calls this directly

Calls 11

_load_asyncToGeneratorFunction · 0.85
_load_errorsFunction · 0.85
_load_fsFunction · 0.85
_load_constantsFunction · 0.85
checkMethod · 0.80
setForceMethod · 0.80
langMethod · 0.45
successMethod · 0.45

Tested by

no test coverage detected