build: improve build script to support multiple targets

This commit is contained in:
Evan You
2019-10-02 11:19:30 -04:00
parent b33f0ceff1
commit 776bc73a5a
2 changed files with 20 additions and 16 deletions

View File

@@ -11,16 +11,18 @@ const targets = (exports.targets = fs.readdirSync('packages').filter(f => {
return true
}))
exports.fuzzyMatchTarget = (partialTarget, includeAllMatching) => {
exports.fuzzyMatchTarget = (partialTargets, includeAllMatching) => {
const matched = []
for (const target of targets) {
if (target.match(partialTarget)) {
matched.push(target)
if (!includeAllMatching) {
return matched
partialTargets.some(partialTarget => {
for (const target of targets) {
if (target.match(partialTarget)) {
matched.push(target)
if (!includeAllMatching) {
break
}
}
}
}
})
if (matched.length) {
return matched
} else {