naive-ui/scripts/utils/index.js

16 lines
489 B
JavaScript
Raw Normal View History

2021-02-03 17:09:12 +08:00
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
}
}
2021-02-03 20:20:00 +08:00
2021-02-03 21:38:43 +08:00
exports.outDirs = ['es', 'lib'].map((d) => path.resolve(__dirname, '../..', d))
exports.srcDir = path.resolve(__dirname, '../../src')
exports.replaceDefine = require('./replace-define').replaceDefine