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

Method getPossibleConfigLocations

bin/yarn-standalone.js:32895–32963  ·  view source on GitHub ↗
(filename, reporter)

Source from the content-addressed store, hash-verified

32893 }
32894
32895 getPossibleConfigLocations(filename, reporter) {
32896 var _this3 = this;
32897
32898 return (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* () {
32899 let possibles = [];
32900
32901 for (var _iterator = _this3.extraneousRcFiles.slice().reverse(), _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) {
32902 var _ref;
32903
32904 if (_isArray) {
32905 if (_i >= _iterator.length) break;
32906 _ref = _iterator[_i++];
32907 } else {
32908 _i = _iterator.next();
32909 if (_i.done) break;
32910 _ref = _i.value;
32911 }
32912
32913 const rcFile = _ref;
32914
32915 possibles.push([false, (_path2 || _load_path2()).default.resolve(process.cwd(), rcFile)]);
32916 }
32917
32918 if (_this3.enableDefaultRc) {
32919 // npmrc --> ./.npmrc, ~/.npmrc, ${prefix}/etc/npmrc
32920 const localfile = '.' + filename;
32921 possibles = possibles.concat([[false, (_path2 || _load_path2()).default.join(_this3.cwd, localfile)], [true, _this3.config.userconfig || (_path2 || _load_path2()).default.join((_userHomeDir || _load_userHomeDir()).default, localfile)], [false, (_path2 || _load_path2()).default.join(getGlobalPrefix(), 'etc', filename)]]);
32922
32923 // When home directory for global install is different from where $HOME/npmrc is stored,
32924 // E.g. /usr/local/share vs /root on linux machines, check the additional location
32925 if ((_userHomeDir2 || _load_userHomeDir2()).home !== (_userHomeDir || _load_userHomeDir()).default) {
32926 possibles.push([true, (_path2 || _load_path2()).default.join((_userHomeDir2 || _load_userHomeDir2()).home, localfile)]);
32927 }
32928
32929 // npmrc --> ../.npmrc, ../../.npmrc, etc.
32930 const foldersFromRootToCwd = (0, (_path || _load_path()).getPosixPath)(_this3.cwd).split('/');
32931 while (foldersFromRootToCwd.length > 1) {
32932 possibles.push([false, (_path2 || _load_path2()).default.join(foldersFromRootToCwd.join((_path2 || _load_path2()).default.sep), localfile)]);
32933 foldersFromRootToCwd.pop();
32934 }
32935 }
32936
32937 const actuals = [];
32938 for (var _iterator2 = possibles, _isArray2 = Array.isArray(_iterator2), _i2 = 0, _iterator2 = _isArray2 ? _iterator2 : _iterator2[Symbol.iterator]();;) {
32939 var _ref3;
32940
32941 if (_isArray2) {
32942 if (_i2 >= _iterator2.length) break;
32943 _ref3 = _iterator2[_i2++];
32944 } else {
32945 _i2 = _iterator2.next();
32946 if (_i2.done) break;
32947 _ref3 = _i2.value;
32948 }
32949
32950 const _ref2 = _ref3;
32951 const isHome = _ref2[0];
32952 const loc = _ref2[1];

Callers 2

loadConfigMethod · 0.80
loadConfigMethod · 0.80

Calls 13

_load_asyncToGeneratorFunction · 0.85
_load_path2Function · 0.85
_load_userHomeDirFunction · 0.85
getGlobalPrefixFunction · 0.85
_load_userHomeDir2Function · 0.85
_load_pathFunction · 0.85
_load_fsFunction · 0.85
concatMethod · 0.80
nextMethod · 0.45
pushMethod · 0.45
resolveMethod · 0.45
verboseMethod · 0.45

Tested by

no test coverage detected