@commitlint/format 19.8.0 → 20.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/format.d.ts +1 -1
- package/lib/format.js +17 -17
- package/lib/format.js.map +1 -1
- package/lib/index.d.ts +2 -2
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +2 -2
- package/lib/index.js.map +1 -1
- package/package.json +4 -4
package/lib/format.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { FormattableReport, FormatOptions, FormattableResult } from
|
|
1
|
+
import { FormattableReport, FormatOptions, FormattableResult } from "@commitlint/types";
|
|
2
2
|
export declare function format(report?: FormattableReport, options?: FormatOptions): string;
|
|
3
3
|
export declare function formatResult(result?: FormattableResult, options?: FormatOptions): string[];
|
|
4
4
|
export default format;
|
package/lib/format.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import chalk from
|
|
2
|
-
const DEFAULT_SIGNS = [
|
|
3
|
-
const DEFAULT_COLORS = [
|
|
1
|
+
import chalk from "chalk";
|
|
2
|
+
const DEFAULT_SIGNS = [" ", "⚠", "✖"];
|
|
3
|
+
const DEFAULT_COLORS = ["white", "yellow", "red"];
|
|
4
4
|
export function format(report = {}, options = {}) {
|
|
5
5
|
const { results = [] } = report;
|
|
6
6
|
const fi = (result) => formatInput(result, options);
|
|
@@ -9,15 +9,15 @@ export function format(report = {}, options = {}) {
|
|
|
9
9
|
.filter((r) => Array.isArray(r.warnings) || Array.isArray(r.errors))
|
|
10
10
|
.map((result) => [...fi(result), ...fr(result)])
|
|
11
11
|
.reduce((acc, item) => (Array.isArray(item) ? [...acc, ...item] : [...acc, item]), [])
|
|
12
|
-
.join(
|
|
12
|
+
.join("\n");
|
|
13
13
|
}
|
|
14
14
|
function formatInput(result, options = {}) {
|
|
15
15
|
const { color: enabled = true } = options;
|
|
16
|
-
const { errors = [], warnings = [], input =
|
|
16
|
+
const { errors = [], warnings = [], input = "" } = result;
|
|
17
17
|
if (!input) {
|
|
18
|
-
return [
|
|
18
|
+
return [""];
|
|
19
19
|
}
|
|
20
|
-
const sign =
|
|
20
|
+
const sign = "⧗";
|
|
21
21
|
const decoration = enabled ? chalk.gray(sign) : sign;
|
|
22
22
|
const decoratedInput = enabled ? chalk.bold(input) : input;
|
|
23
23
|
const hasProblems = errors.length > 0 || warnings.length > 0;
|
|
@@ -29,8 +29,8 @@ export function formatResult(result = {}, options = {}) {
|
|
|
29
29
|
const { signs = DEFAULT_SIGNS, colors = DEFAULT_COLORS, color: enabled = true, } = options;
|
|
30
30
|
const { errors = [], warnings = [] } = result;
|
|
31
31
|
const problems = [...errors, ...warnings].map((problem) => {
|
|
32
|
-
const sign = signs[problem.level] ||
|
|
33
|
-
const color = colors[problem.level] ||
|
|
32
|
+
const sign = signs[problem.level] || "";
|
|
33
|
+
const color = colors[problem.level] || "white";
|
|
34
34
|
const decoration = enabled ? chalk[color](sign) : sign;
|
|
35
35
|
const name = enabled
|
|
36
36
|
? chalk.grey(`[${problem.name}]`)
|
|
@@ -46,29 +46,29 @@ export function formatResult(result = {}, options = {}) {
|
|
|
46
46
|
const summary = options.verbose || hasProblems
|
|
47
47
|
? `${deco} found ${el} problems, ${wl} warnings`
|
|
48
48
|
: undefined;
|
|
49
|
-
const fmtSummary = enabled && typeof summary ===
|
|
49
|
+
const fmtSummary = enabled && typeof summary === "string" ? chalk.bold(summary) : summary;
|
|
50
50
|
const help = hasProblems && options.helpUrl
|
|
51
51
|
? `ⓘ Get help: ${options.helpUrl}`
|
|
52
52
|
: undefined;
|
|
53
53
|
return [
|
|
54
54
|
...problems,
|
|
55
|
-
hasProblems ?
|
|
55
|
+
hasProblems ? "" : undefined,
|
|
56
56
|
fmtSummary,
|
|
57
57
|
help,
|
|
58
|
-
hasProblems ?
|
|
59
|
-
].filter((line) => typeof line ===
|
|
58
|
+
hasProblems ? "" : undefined,
|
|
59
|
+
].filter((line) => typeof line === "string");
|
|
60
60
|
}
|
|
61
61
|
export default format;
|
|
62
62
|
function selectSign(result) {
|
|
63
63
|
if ((result.errors || []).length > 0) {
|
|
64
|
-
return
|
|
64
|
+
return "✖";
|
|
65
65
|
}
|
|
66
|
-
return (result.warnings || []).length ?
|
|
66
|
+
return (result.warnings || []).length ? "⚠" : "✔";
|
|
67
67
|
}
|
|
68
68
|
function selectColor(result) {
|
|
69
69
|
if ((result.errors || []).length > 0) {
|
|
70
|
-
return
|
|
70
|
+
return "red";
|
|
71
71
|
}
|
|
72
|
-
return (result.warnings || []).length ?
|
|
72
|
+
return (result.warnings || []).length ? "yellow" : "green";
|
|
73
73
|
}
|
|
74
74
|
//# sourceMappingURL=format.js.map
|
package/lib/format.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"format.js","sourceRoot":"","sources":["../src/format.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAS1B,MAAM,aAAa,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAU,CAAC;AAC/C,MAAM,cAAc,GAAG,CAAC,OAAO,EAAE,QAAQ,EAAE,KAAK,CAAU,CAAC;AAE3D,MAAM,UAAU,MAAM,CACrB,SAA4B,EAAE,EAC9B,UAAyB,EAAE;IAE3B,MAAM,
|
|
1
|
+
{"version":3,"file":"format.js","sourceRoot":"","sources":["../src/format.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAS1B,MAAM,aAAa,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAU,CAAC;AAC/C,MAAM,cAAc,GAAG,CAAC,OAAO,EAAE,QAAQ,EAAE,KAAK,CAAU,CAAC;AAE3D,MAAM,UAAU,MAAM,CACrB,SAA4B,EAAE,EAC9B,UAAyB,EAAE;IAE3B,MAAM,EAAE,OAAO,GAAG,EAAE,EAAE,GAAG,MAAM,CAAC;IAChC,MAAM,EAAE,GAAG,CAAC,MAAqC,EAAE,EAAE,CACp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GAAG,CAAC,EAAE,CAAC;QACtC,OAAO,GAAG,CAAC;IACZ,CAAC;IACD,OAAO,CAAC,MAAM,CAAC,QAAQ,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC;AACnD,CAAC;AAED,SAAS,WAAW,CAAC,MAAyB;IAC7C,IAAI,CAAC,MAAM,CAAC,MAAM,IAAI,EAAE,CAAC,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACtC,OAAO,KAAK,CAAC;IACd,CAAC;IACD,OAAO,CAAC,MAAM,CAAC,QAAQ,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC;AAC5D,CAAC"}
|
package/lib/index.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { default } from
|
|
2
|
-
export * from
|
|
1
|
+
export { default } from "./format.js";
|
|
2
|
+
export * from "./format.js";
|
|
3
3
|
//# sourceMappingURL=index.d.ts.map
|
package/lib/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AACtC,cAAc,aAAa,CAAC"}
|
package/lib/index.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { default } from
|
|
2
|
-
export * from
|
|
1
|
+
export { default } from "./format.js";
|
|
2
|
+
export * from "./format.js";
|
|
3
3
|
//# sourceMappingURL=index.js.map
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AACtC,cAAc,aAAa,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@commitlint/format",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "
|
|
4
|
+
"version": "20.0.0",
|
|
5
5
|
"description": "Format commitlint reports",
|
|
6
6
|
"main": "lib/index.js",
|
|
7
7
|
"types": "lib/index.d.ts",
|
|
@@ -36,11 +36,11 @@
|
|
|
36
36
|
},
|
|
37
37
|
"license": "MIT",
|
|
38
38
|
"devDependencies": {
|
|
39
|
-
"@commitlint/utils": "^
|
|
39
|
+
"@commitlint/utils": "^20.0.0"
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
|
-
"@commitlint/types": "^
|
|
42
|
+
"@commitlint/types": "^20.0.0",
|
|
43
43
|
"chalk": "^5.3.0"
|
|
44
44
|
},
|
|
45
|
-
"gitHead": "
|
|
45
|
+
"gitHead": "407be6c96b1a108ee012ed5330b0d80a165952d5"
|
|
46
46
|
}
|