naive-ui/scripts/utils/index.js
2021-02-03 21:38:43 +08:00

13 lines
368 B
JavaScript

const fs = require('fs').promises
const path = require('path')
exports.walk = async function * walk (dir) {
for await (const d of await fs.opendir(dir)) {
const entry = path.join(dir, d.name)
if (d.isDirectory()) yield * walk(entry)
else if (d.isFile()) yield entry
}
}
exports.outDirs = ['es', 'lib'].map((d) => path.resolve(__dirname, '../..', d))