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

Method loadConfig

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

Source from the content-addressed store, hash-verified

103506 }
103507
103508 loadConfig() {
103509 var _this = this;
103510
103511 return (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* () {
103512 const locations = yield _this.getPossibleConfigLocations('yarnrc', _this.reporter);
103513
103514 for (var _iterator = locations, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) {
103515 var _ref2;
103516
103517 if (_isArray) {
103518 if (_i >= _iterator.length) break;
103519 _ref2 = _iterator[_i++];
103520 } else {
103521 _i = _iterator.next();
103522 if (_i.done) break;
103523 _ref2 = _i.value;
103524 }
103525
103526 const _ref = _ref2;
103527 const isHome = _ref[0];
103528 const loc = _ref[1];
103529 const file = _ref[2];
103530
103531 var _parse = (0, (_lockfile || _load_lockfile()).parse)(file, loc);
103532
103533 const config = _parse.object;
103534
103535
103536 if (isHome) {
103537 _this.homeConfig = config;
103538 }
103539
103540 for (var _iterator2 = RELATIVE_KEYS, _isArray2 = Array.isArray(_iterator2), _i2 = 0, _iterator2 = _isArray2 ? _iterator2 : _iterator2[Symbol.iterator]();;) {
103541 var _ref3;
103542
103543 if (_isArray2) {
103544 if (_i2 >= _iterator2.length) break;
103545 _ref3 = _iterator2[_i2++];
103546 } else {
103547 _i2 = _iterator2.next();
103548 if (_i2.done) break;
103549 _ref3 = _i2.value;
103550 }
103551
103552 const key = _ref3;
103553
103554 const valueLoc = config[key];
103555
103556 if (!_this.config[key] && valueLoc) {
103557 const resolvedLoc = config[key] = path.resolve(path.dirname(loc), valueLoc);
103558
103559 if (FOLDER_KEY.includes(key)) {
103560 yield (_fs || _load_fs()).mkdirp(resolvedLoc);
103561 }
103562 }
103563 }
103564
103565 // merge with any existing environment variables

Callers

nothing calls this directly

Calls 6

_load_asyncToGeneratorFunction · 0.85
_load_lockfileFunction · 0.85
_load_fsFunction · 0.85
nextMethod · 0.45
resolveMethod · 0.45

Tested by

no test coverage detected