diff options
author | LinuxWizard42 <computerwizard@linuxmail.org> | 2022-10-12 23:08:57 +0300 |
---|---|---|
committer | LinuxWizard42 <computerwizard@linuxmail.org> | 2022-10-12 23:08:57 +0300 |
commit | 726b81b19251674e149ccfbb1abacbd837fc6db0 (patch) | |
tree | fbdbb227dc01357eb76e8222d76185bc124c5ca6 /node_modules/get-package-info/lib/index.js | |
parent | 34f0890e175698940d49238097579f44e4d78c89 (diff) | |
download | FlashRunner-726b81b19251674e149ccfbb1abacbd837fc6db0.tar.gz FlashRunner-726b81b19251674e149ccfbb1abacbd837fc6db0.tar.zst |
Removed files that should not have been included in git
Diffstat (limited to 'node_modules/get-package-info/lib/index.js')
-rw-r--r-- | node_modules/get-package-info/lib/index.js | 88 |
1 files changed, 0 insertions, 88 deletions
diff --git a/node_modules/get-package-info/lib/index.js b/node_modules/get-package-info/lib/index.js deleted file mode 100644 index 61b17dc..0000000 --- a/node_modules/get-package-info/lib/index.js +++ /dev/null @@ -1,88 +0,0 @@ -'use strict'; - -var Promise = require('bluebird'); -var get = require('lodash.get'); -var readPkgUp = require('read-pkg-up'); -var path = require('path'); -var debug = require('debug')('get-package-info'); - -var getInfo = function getInfo(props, dir, result) { - if (!Array.isArray(props)) return Promise.reject(new Error('First argument must be array of properties to retrieve.')); - if (!props.length) return Promise.resolve(result); - - debug('Getting props: ', props); - debug('Looking up starting from directory: ', dir); - debug('Result so far:', result); - - return Promise.resolve(readPkgUp({ cwd: dir, normalize: false })).then(function (_ref) { - var src = _ref.path; - var pkg = _ref.pkg; - - if (!src) { - debug('Couldn\'t find any more package.json files'); - var err = new Error('Unable to find all properties in parent package.json files. Missing props: ' + props.map(function (prop) { - return JSON.stringify(prop); - }).join(', ')); - err.missingProps = props; - err.result = result; - throw err; - } - - debug('Checking props in package.json found at:', src); - var nextProps = []; - - props.forEach(function (prop) { - // For props given as array - // Look for props in that order, and when found - // save value under all given props - if (Array.isArray(prop)) { - (function () { - var value = void 0, - sourceProp = void 0; - - prop.some(function (p) { - sourceProp = p; - value = get(pkg, p); - return value; - }); - - if (value !== undefined) { - debug('Found prop:', prop); - prop.forEach(function (p) { - result.values[p] = value; - result.source[p] = { src: src, pkg: pkg, prop: sourceProp }; - }); - } else { - debug('Couldn\'t find prop:', prop); - nextProps.push(prop); - } - })(); - } else { - // For regular string props, just look normally - var _value = get(pkg, prop); - - if (_value !== undefined) { - debug('Found prop:', prop); - result.values[prop] = _value; - result.source[prop] = { src: src, pkg: pkg, prop: prop }; - } else { - debug('Couldn\'t find prop:', prop); - nextProps.push(prop); - } - } - }); - - // Still have props to look for, look at another package.json above this one - if (nextProps.length) { - debug('Not all props satisfied, looking for parent package.json'); - return getInfo(nextProps, path.join(path.dirname(src), '..'), result); - } - - debug('Found all props!'); - return result; - }); -}; - -module.exports = function (props, dir, cb) { - return getInfo(props, dir, { values: {}, source: {} }).nodeify(cb); -};
\ No newline at end of file |