@commitlint/format
Advanced tools
Comparing version 7.6.1 to 8.0.0
@@ -1,94 +0,9 @@ | ||
'use strict'; | ||
var _chalk = require('chalk'); | ||
var _chalk2 = _interopRequireDefault(_chalk); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
const DEFAULT_SIGNS = [' ', '⚠', '✖']; | ||
const DEFAULT_COLORS = ['white', 'yellow', 'red']; | ||
module.exports = format; | ||
module.exports.default = format; | ||
module.exports.format = format; | ||
module.exports.formatResult = formatResult; | ||
function format(report = {}, options = {}) { | ||
var _report$results = report.results; | ||
const results = _report$results === undefined ? [] : _report$results; | ||
if (results.length > 0) { | ||
return results.map(result => `${formatInput(result, options)}${formatResult(result, options).join('\n')}`).join('\n'); | ||
} | ||
// Output a summary when nothing is found | ||
return formatResult({}, options).join('\n'); | ||
"use strict"; | ||
function __export(m) { | ||
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; | ||
} | ||
function formatInput(result = {}, options = {}) { | ||
var _options$color = options.color; | ||
const enabled = _options$color === undefined ? true : _options$color; | ||
var _result$errors = result.errors; | ||
const errors = _result$errors === undefined ? [] : _result$errors; | ||
var _result$input = result.input; | ||
const input = _result$input === undefined ? '' : _result$input; | ||
if (!input) { | ||
return ''; | ||
} | ||
const sign = '⧗'; | ||
const decoration = enabled ? _chalk2.default.gray(sign) : sign; | ||
const commitText = errors.length > 0 ? input : input.split('\n')[0]; | ||
const decoratedInput = enabled ? _chalk2.default.bold(commitText) : commitText; | ||
return `\n${decoration} input: ${decoratedInput}\n`; | ||
} | ||
function formatResult(result = {}, options = {}) { | ||
var _options$signs = options.signs; | ||
const signs = _options$signs === undefined ? DEFAULT_SIGNS : _options$signs; | ||
var _options$colors = options.colors; | ||
const colors = _options$colors === undefined ? DEFAULT_COLORS : _options$colors; | ||
var _options$color2 = options.color; | ||
const enabled = _options$color2 === undefined ? true : _options$color2; | ||
var _result$errors2 = result.errors; | ||
const errors = _result$errors2 === undefined ? [] : _result$errors2; | ||
var _result$warnings = result.warnings; | ||
const warnings = _result$warnings === undefined ? [] : _result$warnings; | ||
const problems = [...errors, ...warnings].map(problem => { | ||
const sign = signs[problem.level] || ''; | ||
const color = colors[problem.level] || 'white'; | ||
const decoration = enabled ? _chalk2.default[color](sign) : sign; | ||
const name = enabled ? _chalk2.default.grey(`[${problem.name}]`) : `[${problem.name}]`; | ||
return `${decoration} ${problem.message} ${name}`; | ||
}); | ||
const sign = selectSign({ errors, warnings }); | ||
const color = selectColor({ errors, warnings }); | ||
const decoration = enabled ? _chalk2.default[color](sign) : sign; | ||
const summary = `${decoration} found ${errors.length} problems, ${warnings.length} warnings \n (Need help? -> https://github.com/conventional-changelog/commitlint#what-is-commitlint )\n\n`; | ||
return [...problems, enabled ? _chalk2.default.bold(summary) : summary]; | ||
} | ||
function selectSign(result) { | ||
if (result.errors.length > 0) { | ||
return '✖'; | ||
} | ||
return result.warnings.length ? '⚠' : '✔'; | ||
} | ||
function selectColor(result) { | ||
if (result.errors.length > 0) { | ||
return 'red'; | ||
} | ||
return result.warnings.length ? 'yellow' : 'green'; | ||
} | ||
exports.__esModule = true; | ||
var format_1 = require("./format"); | ||
exports["default"] = format_1["default"]; | ||
__export(require("./format")); | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "@commitlint/format", | ||
"version": "7.6.1", | ||
"version": "8.0.0", | ||
"description": "Format commitlint reports", | ||
@@ -10,28 +10,9 @@ "main": "lib/index.js", | ||
"scripts": { | ||
"build": "cross-env NODE_ENV=production babel src --out-dir lib --source-maps", | ||
"build": "tsc", | ||
"deps": "dep-check", | ||
"pkg": "pkg-check --skip-import", | ||
"start": "concurrently \"ava -c 4 --verbose --watch\" \"yarn run watch\"", | ||
"test": "ava -c 4 --verbose", | ||
"watch": "babel src --out-dir lib --watch --source-maps" | ||
"start": "concurrently \"yarn test --watchAll\" \"yarn run watch\"", | ||
"test": "jest", | ||
"watch": "tsc -w" | ||
}, | ||
"ava": { | ||
"files": [ | ||
"src/**/*.test.js", | ||
"!lib/**/*" | ||
], | ||
"source": [ | ||
"src/**/*.js", | ||
"!lib/**/*" | ||
], | ||
"babel": "inherit", | ||
"require": [ | ||
"babel-register" | ||
] | ||
}, | ||
"babel": { | ||
"presets": [ | ||
"babel-preset-commitlint" | ||
] | ||
}, | ||
"engines": { | ||
@@ -60,17 +41,17 @@ "node": ">=4" | ||
"devDependencies": { | ||
"@commitlint/test": "^7.6.0", | ||
"@commitlint/utils": "^7.6.0", | ||
"ava": "0.22.0", | ||
"babel-cli": "6.26.0", | ||
"babel-preset-commitlint": "^7.6.0", | ||
"babel-register": "6.26.0", | ||
"@commitlint/test": "^8.0.0", | ||
"@commitlint/utils": "^8.0.0", | ||
"@types/jest": "24.0.12", | ||
"@types/lodash": "4.14.123", | ||
"concurrently": "3.5.1", | ||
"cross-env": "5.1.1", | ||
"lodash": "4.17.11" | ||
"jest": "24.7.1", | ||
"rimraf": "2.6.1", | ||
"ts-jest": "24.0.2", | ||
"typescript": "3.4.5" | ||
}, | ||
"dependencies": { | ||
"babel-runtime": "^6.23.0", | ||
"chalk": "^2.0.1" | ||
}, | ||
"gitHead": "dc5619dea62b7b8ac72dc7758d70b684e010557b" | ||
"gitHead": "29d1cee10ee7734a85d97ef039c4ce2da633628c" | ||
} |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1
12
17725
10
122
1
- Removedbabel-runtime@^6.23.0
- Removedbabel-runtime@6.26.0(transitive)
- Removedcore-js@2.6.12(transitive)
- Removedregenerator-runtime@0.11.1(transitive)