packages/config/config.js
function resolveConfig (fileName, options) {
  options = options || {}
  var schema = options.schema
  var resolvePackageJson = options.resolvePackageJson || false
  var fileNames = [fileName, resolvePackageJson ? 'package.json' : null].filter(
    item => !!item
  )
  const results = upResolve(fileNames)
  return Promise.all(results.map(readFileAsync))
    .then(parseFiles(options))
    .then(validateSchema(schema))
    .then(reduceConfigs)
}
function resolveConfig (fileName, options) {
  options = options || {}
  var schema = options.schema
  var resolvePackageJson = options.resolvePackageJson || false
  var fileNames = [fileName, resolvePackageJson ? 'package.json' : null].filter(
    item => !!item
  )
  const results = upResolve(fileNames)
  return Promise.all(results.map(readFileAsync))
    .then(parseFiles(options))
    .then(validateSchema(schema))
    .then(reduceConfigs)
}
function resolveConfig ( fileName , options ) { options = options || { } var schema = options . schema var resolvePackageJson = options . resolvePackageJson || false var fileNames = [ fileName , resolvePackageJson ? 'package.json' : null ] . filter ( item => ! ! item ) const results = upResolve ( fileNames ) return Promise . all ( results . map ( readFileAsync ) ) . then ( parseFiles ( options ) ) . then ( validateSchema ( schema ) ) . then ( reduceConfigs ) }
Resolves config files, parses and combines them with priority to the nearest file
@param {String} fileName
@param {Object} options
@param {Object} options.schema - validation options, see https://www.npmjs.com/package/jsonschema
@param {boolean} options.resolvePackageJson - also include config from package.json
@param {String} options.packageJsonKey - key to extract config from package json. eg {version: "0.0.1", deps: {...}, myConfg: {...}} => myConfig
Resolves config files parses and combines them with priority to the nearest file