chore: updated error message for not-found fuzzy-matching error (#303)

This commit is contained in:
Ivan Sieder 2019-10-15 23:13:35 +02:00 committed by Evan You
parent db5c343c33
commit b60355d857

View File

@ -1,4 +1,5 @@
const fs = require('fs') const fs = require('fs')
const chalk = require('chalk')
const targets = (exports.targets = fs.readdirSync('packages').filter(f => { const targets = (exports.targets = fs.readdirSync('packages').filter(f => {
if (!fs.statSync(`packages/${f}`).isDirectory()) { if (!fs.statSync(`packages/${f}`).isDirectory()) {
@ -26,6 +27,14 @@ exports.fuzzyMatchTarget = (partialTargets, includeAllMatching) => {
if (matched.length) { if (matched.length) {
return matched return matched
} else { } else {
throw new Error(`Target ${partialTargets} not found!`) console.log()
console.error(
` ${chalk.bgRed.white(' ERROR ')} ${chalk.red(
`Target ${chalk.underline(partialTargets)} not found!`
)}`
)
console.log()
process.exit(1)
} }
} }