import Vue from 'vue'

const components = require.context('.', true, /index\.vue$/)
// const requireAll = requireContext => requireContext.keys().map(requireContext)
// requireAll(req)

components.keys().forEach(fileName => {
  const file = components(fileName)
  if (file.default.name) {
    console.log(fileName.replace(/\/index\.vue/, ''), 'to', file.default.name)
    Vue.component(file.default.name, file.default)
  } else {
    console.warn('unknown component', fileName)
  }
})
