mirror of
https://github.com/vuejs/vue-cli.git
synced 2026-01-24 16:18:57 -06:00
19 lines
367 B
JavaScript
19 lines
367 B
JavaScript
const joi = require('joi')
|
|
const { exit } = require('./exit')
|
|
|
|
// proxy to joi for option validation
|
|
exports.createSchema = fn => fn(joi)
|
|
|
|
exports.validate = (obj, schema, cb) => {
|
|
joi.validate(obj, schema, {}, err => {
|
|
if (err) {
|
|
cb(err.message)
|
|
if (process.env.VUE_CLI_TEST) {
|
|
throw err
|
|
} else {
|
|
exit(1)
|
|
}
|
|
}
|
|
})
|
|
}
|