embed-support
Version:
Create embed codes for a static web project
27 lines (21 loc) • 706 B
JavaScript
;
/* eslint-disable no-console */
var fileExists = require('file-exists');
var chalk = require('chalk');
// return true if there are no errors
module.exports = function validateOptions(opts) {
var errors = false;
if (!opts.dest) {
console.log(chalk.red('[Error]') + ' ' + chalk.blue('dest') + ' is not defined');
errors = true;
}
if (opts.template && !fileExists(opts.template)) {
console.log(chalk.red('[Error]') + ' template file ' + (chalk.blue(opts.template) + ' does not exist'));
errors = true;
}
if (!opts.iframeUrl) {
console.log(chalk.red('[Error]') + ' ' + chalk.blue('iframeUrl') + ' is not defined');
errors = true;
}
return !errors;
};