utils/index.js
/**
 * Look for user resource in configured directory
 * or in node_moduels directory
 **/
Look for user resource in configured directory
or in node_moduels directory
Look for user resource in configured directory or in node_moduels directory
function loadExtension(extension, extensionsPath) {
  console.log(extension) 
  const nodeModulesPath = config.get('NODE_MODULES_PATH')
  const userResource = path.join(process.cwd(), extensionsPath, extension, 'index.js')
  const npmResource = path.join(process.cwd(), nodeModulesPath, extension)
  if (fs.existsSync(userResource)) {
    return require(userResource)
  } else if (fs.existsSync(npmResource)) {
    return require(extension)
  } else {
    throw new Error(`Cannot find configured extension -- ${extension}. Is it installed? If the extension is an npm module try to run\n"yarn add ${extension}"\nIf it is a user extension, make sure the the directory at ${extensionsPath} exists and there is a valid index.js file there.`)
  }
}
function loadExtension ( extension , extensionsPath ) { console . log ( extension ) const nodeModulesPath = config . get ( 'NODE_MODULES_PATH' ) const userResource = path . join ( process . cwd ( ) , extensionsPath , extension , 'index.js' ) const npmResource = path . join ( process . cwd ( ) , nodeModulesPath , extension ) if ( fs . existsSync ( userResource ) ) { return require ( userResource ) } else if ( fs . existsSync ( npmResource ) ) { return require ( extension ) } else { throw new Error ( ` ${ extension } \n ${ extension } \n ${ extensionsPath } ` ) } }
Look for user resource in configured directory
 or in node_moduels directory
Look for user resource in configured directory or in node_moduels directory
// stdout // look for plugin in user space // otherwise look in node_modules // if all else fails give the user a helping hand