release-checker
Version:
Check your release before publishing
58 lines (57 loc) • 1.99 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
var usage_1 = require("../../cli-options/usage");
var extract_first_line_of_1 = require("../common/extract-first-line-of");
exports.ciReporter = {
name: 'ci',
reportErrorStatusFor: reportErrorStatusFor,
reportIntro: reportIntro,
reportSuccessStatusFor: reportSuccessStatusFor,
reportUsage: reportUsage,
reportValidationErrorsOf: reportValidationErrorsOf,
reportValidationWarningsOf: reportValidationWarningsOf,
reportWarningStatusFor: reportWarningStatusFor,
};
function reportUsage() {
console.log(usage_1.usage);
}
function reportIntro() {
console.log('');
console.log('Running validations ...');
console.log('');
}
function reportValidationErrorsOf(checkers) {
console.log('');
console.log('ERRORS:');
checkers.forEach(function (checker) {
checker.errors = checker.errors || [];
checker.errors.forEach(function (validationError) {
console.log(" * " + extract_first_line_of_1.extractFirstLineOf(validationError.reason));
});
});
}
function reportValidationWarningsOf(checkers) {
var hasNoWarning = checkers
.filter(function (checker) { return checker.hasWarnings; })
.length === 0;
if (hasNoWarning) {
return;
}
console.log('');
console.log('WARNINGS:');
checkers.forEach(function (checker) {
checker.warnings = checker.warnings || [];
checker.warnings.forEach(function (validationWarning) {
console.log(" * " + extract_first_line_of_1.extractFirstLineOf(validationWarning.reason));
});
});
}
function reportWarningStatusFor(checker) {
console.log("[!] " + checker.statusToDisplayWhileValidating);
}
function reportErrorStatusFor(checker) {
console.log("[x] " + checker.statusToDisplayWhileValidating);
}
function reportSuccessStatusFor(checker) {
console.log("[v] " + checker.statusToDisplayWhileValidating);
}