<repo_name>MewenLr/dummies<file_sep>/dummylib/README.md
# dummylib

## Steps

- create folder /libray

- run cmd build library

- add main entry in package.json

- import library and style in project
<file_sep>/dummylib/src/test.js
import DummyButton from './components/DummyButton.vue'

export default DummyButton
<file_sep>/dummylib/src/library/generate.js
const fs = require('fs')
const glob = require('glob')
const path = require('path')

const templateComponents = require('./template.js')

function getComponents(callback) {
  glob('src/components/**/*.vue', callback)
}

function handleResult(err, res) {
  if (err) {
    console.error('Error', err)
    process.exit(1)
  } else {
    const re = /.*\/+(.*).vue$/

    const components = res.reduce((result, element) => {
      if (!element.includes('Index.vue')) {
        result.push({
          name: element.replace(re, '$1'),
          path: element.replace(/src\//, '@/'),
        })
      }
      return result
    }, [])

    const outputPath = path.resolve(__dirname, './components.js')

    fs.writeFileSync(outputPath, templateComponents(components))
  }
}

getComponents(handleResult)
