text: import _debug from 'debug'
  import path from 'path'
  import { argv } from 'yargs'
  
  const debug = _debug('app:config:_base')
  const config = {
      env: process.env.NODE_ENV || 'development',
      
      //-------------------------
      // Project Structure
      //-------------------------
      path_base   : path.resolve(__dirname, '../'),
      dir_client  : 'src',
      dir_dist    : 'dist',
      dir_server  : 'server',
      dir_test    : 'tests',
      
      //------------------------
      // Server Configuration
      //------------------------
      server_host :   'localhost',
      server_port :   process.env.Port || 3000,
      
      //------------------------
      // Compiler Configuration
      //------------------------
      compiler_css_modules    : true,
      compiler_devtool        : 'source-map',
      compiler_hash_type      : 'hash',
      compiler_fail_on_warning: false,
      compiler_quiet          : false,
      compiler_public_path    : '',
      compiler_stats          : {
          chunks      : false,
          chunkModules: false,
          colors      : true,
      },
      compiler_vendor :   [
          'history',
          'react',
          'react-redux',
          'react-router',
          'redux',
          'redux-actions',
          'redux-simple-router'
      ],
      
      //-------------------------
      // Test Configuration
      //-------------------------
      converage_enable    : !argv.watch,
      converage_reporters : [
          { type  : 'text-summmary' },
          { type  : 'html', dir : 'converage' }
      ]
  }
  
  /******************************************************
  ***
  *** All Internal Configuration Below
  *** Edit at Your Own Risk
  ***
  ******************************************************/
  
  //------------------------------
  // Environment
  //------------------------------
  // N.B.: globals added here must _also_ be added to .eslintrc
  config.globals = {
      'process.env'   : {
          'NODE_ENV'  : JSON.stringify(config.env)
      },
      'NODE_ENV'  : config.env,
      '__DEV__'   : config.env === 'development',
      '__PROD__'  : config.env === 'production',
      '__TEST__'  : config.env === 'test',
      '__DEBUG__' : config.env === 'development' && !argv.no_debug,
      '__DEBUG_NEW_WINDOW__'  : !!argv.nw,
      '__BASENAME__'  : JSON.stringify(process.env.BASENAME || '')
  }
  
  //-------------------------------
  // Validate Vendor Dependencies
  //-------------------------------
  const pkg = require('../package.json')
  
  config.compiler_vendor = config.compiler_vendor
      .filter(dep => {
          if(pkg.dependancies[dep]) return true
          debug(
              `Package "${dep}" was not found as an npm dependancy in package.json; ` +
              `it won't be included in the webpack vendor bundle.\n` +
              `Consider removing it from vendor_dependencies in ~/config/index.js`
          )
      })
  
  //------------------------------
  // Utilities
  //------------------------------
  config.utils_path = (() => {
      const resolve = path.resolve
      
      const base = (...args) => 
          resolve.apply(resolve, [config.path_base, ...args])
          
      return {
          base    : base,
          client  : base.bind(null, config.dir_client),
          dist    : base.bind(null, config.dir_dist)
      }
  })()
  
  export default config
  