MCPcopy
hub / github.com/Kong/insomnia / fromDirectory

Method fromDirectory

packages/insomnia/bin/yarn-standalone.js:2795–2823  ·  view source on GitHub ↗
(dir, reporter)

Source from the content-addressed store, hash-verified

2793 }
2794
2795 static fromDirectory(dir, reporter) {
2796 return (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* () {
2797 // read the manifest in this directory
2798 const lockfileLoc = path.join(dir, (_constants || _load_constants()).LOCKFILE_FILENAME);
2799
2800 let lockfile;
2801 let rawLockfile = '';
2802 let parseResult;
2803
2804 if (yield (_fs || _load_fs()).exists(lockfileLoc)) {
2805 rawLockfile = yield (_fs || _load_fs()).readFile(lockfileLoc);
2806 parseResult = (0, (_parse2 || _load_parse2()).default)(rawLockfile, lockfileLoc);
2807
2808 if (reporter) {
2809 if (parseResult.type === 'merge') {
2810 reporter.info(reporter.lang('lockfileMerged'));
2811 } else if (parseResult.type === 'conflict') {
2812 reporter.warn(reporter.lang('lockfileConflict'));
2813 }
2814 }
2815
2816 lockfile = parseResult.object;
2817 } else if (reporter) {
2818 reporter.info(reporter.lang('noLockfileFound'));
2819 }
2820
2821 return new Lockfile({ cache: lockfile, source: rawLockfile, parseResultType: parseResult && parseResult.type });
2822 })();
2823 }
2824
2825 getLocked(pattern) {
2826 const cache = this.cache;

Callers 3

yarn-standalone.jsFile · 0.80
addFunction · 0.80

Calls 8

_load_asyncToGeneratorFunction · 0.85
_load_constantsFunction · 0.85
_load_fsFunction · 0.85
_load_parse2Function · 0.85
readFileMethod · 0.45
infoMethod · 0.45
langMethod · 0.45
warnMethod · 0.45

Tested by

no test coverage detected