index.js
function setConfig (argv) {
    var configLookup = {}

    // expand defaults/aliases, in-case any happen to reference
    // the config.json file.
    applyDefaultsAndAliases(configLookup, flags.aliases, defaults)

    Object.keys(flags.configs).forEach(function (configKey) {
      var configPath = argv[configKey] || configLookup[configKey]
      if (configPath) {
        try {
          var config = null
          var resolvedConfigPath = path.resolve(process.cwd(), configPath)

          if (typeof flags.configs[configKey] === 'function') {
            try {
              config = flags.configs[configKey](resolvedConfigPath)
            } catch (e) {
              config = e
            }
            if (config instanceof Error) {
              error = config
              return
            }
          } else {
            config = require(resolvedConfigPath)
          }

          setConfigObject(config)
        } catch (ex) {
          if (argv[configKey]) error = Error(__('Invalid JSON config file: %s', configPath))
        }
      }
    })
  }
function setConfig (argv) {
    var configLookup = {}

    // expand defaults/aliases, in-case any happen to reference
    // the config.json file.
    applyDefaultsAndAliases(configLookup, flags.aliases, defaults)

    Object.keys(flags.configs).forEach(function (configKey) {
      var configPath = argv[configKey] || configLookup[configKey]
      if (configPath) {
        try {
          var config = null
          var resolvedConfigPath = path.resolve(process.cwd(), configPath)

          if (typeof flags.configs[configKey] === 'function') {
            try {
              config = flags.configs[configKey](resolvedConfigPath)
            } catch (e) {
              config = e
            }
            if (config instanceof Error) {
              error = config
              return
            }
          } else {
            config = require(resolvedConfigPath)
          }

          setConfigObject(config)
        } catch (ex) {
          if (argv[configKey]) error = Error(__('Invalid JSON config file: %s', configPath))
        }
      }
    })
  }
function setConfig ( argv ) { var configLookup = { } // expand defaults/aliases, in-case any happen to reference // the config.json file. applyDefaultsAndAliases ( configLookup , flags . aliases , defaults ) Object . keys ( flags . configs ) . forEach ( function ( configKey ) { var configPath = argv [ configKey ] || configLookup [ configKey ] if ( configPath ) { try { var config = null var resolvedConfigPath = path . resolve ( process . cwd ( ) , configPath ) if ( typeof flags . configs [ configKey ] === 'function' ) { try { config = flags . configs [ configKey ] ( resolvedConfigPath ) } catch ( e ) { config = e } if ( config instanceof Error ) { error = config return } } else { config = require ( resolvedConfigPath ) } setConfigObject ( config ) } catch ( ex ) { if ( argv [ configKey ] ) error = Error ( __ ( 'Invalid JSON config file: %s' , configPath ) ) } } } ) }
set args from config.json file, this should be applied last so that defaults can be applied.
set args from config . json file this should be applied last so that defaults can be applied .