forked from fanruan/fineui
zsmj
3 years ago
5 changed files with 51 additions and 54 deletions
@ -0,0 +1,24 @@
|
||||
const path = require('path'); |
||||
const glob = require('glob'); |
||||
|
||||
// const glob = require('fast-glob');
|
||||
|
||||
function uniq(names) { |
||||
return [...new Set(names)]; |
||||
} |
||||
|
||||
const globalExcludes = [ |
||||
"**/*/__test__/*.js", |
||||
]; |
||||
|
||||
function sync(patterns, excludes = []) { |
||||
const ignore = globalExcludes.concat(excludes).map(pattern => path.join(__dirname, "../", pattern).replace(/\\/g, '/')); |
||||
|
||||
return patterns.map(pattern => glob.sync(path.join(__dirname, "../", pattern).replace(/\\/g, '/'), { ignore })).flat(); |
||||
} |
||||
|
||||
|
||||
module.exports = { |
||||
sync, |
||||
uniq, |
||||
}; |
Loading…
Reference in new issue