const {findApp, chalkTag, copyFiles} = require("./tools");
const start = () => {
  chalkTag.info("扫描主库目录,并搬运打包应用至lib文件夹下")
  let apps = []
  findApp('src/mods', file => apps.push(file))
  .then(() => Promise.all([...new Set(apps)].map(e => {
    let name = e.replace(/.+[\\\/]([^\\\/]+)$/, '$1')
    if (/^App/.test(name)) {
      return copyFiles(`lib/${name}`, e)
    }
  })))
  .then(() => {
    chalkTag.done("打包完成")
  })
}
start()
