const fs = require("fs");
const fse = require("fs-extra")
const path = require("path");
const getDirs = (dir, list = [], cb) => {
  const dirs = fs.readdirSync(dir, {withFileTypes: true})
  dirs.map(d => {
    if (d.isDirectory()) {
      let p = path.join(dir, d.name)
      list.push(p)
      if (cb(d, p)) getDirs(p, list, cb)
    }
  })
  return list
}
getDirs(path.join(__dirname, '..', 'src'), [], (dir, path) => {
  if (["apps"].includes(dir.name)) {
    fse.remove(path)
    console.log("已清除%s", path)
  }
  return !["apps"].includes(dir.name)
})
fse.remove(path.join(__dirname, '..', 'lib'))
