forked from fanruan/fineui
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
24 lines
550 B
24 lines
550 B
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, |
|
};
|
|
|