Skip to content

Commit 4f463fa

Browse files
committed
fix(cz-git): fix breaking char priority than maxNumber
1 parent 73f688c commit 4f463fa

2 files changed

Lines changed: 7 additions & 7 deletions

File tree

‎packages/cz-git/src/generator/build.ts‎

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,6 @@ const addSubject = (subject?: string, colorize?: boolean) => {
5858
return subject.trim();
5959
};
6060

61-
const addBreaklinesIfNeeded = (value: string, breaklineChar = "|") =>
62-
value.split(breaklineChar).join("\n").valueOf();
63-
6461
const addFooter = (footer: string, footerPrefix = "", colorize?: boolean) => {
6562
if (footerPrefix === "") {
6663
return colorize ? `\n\n\u001B[32m${footer}\u001B[0m` : `\n\n${footer}`;
@@ -76,6 +73,7 @@ export const generateMessage = (
7673
colorize = false
7774
) => {
7875
const wrapOptions = {
76+
breaklineChar: options.breaklineChar || "|",
7977
trim: true,
8078
newLine: "\n",
8179
indent: "",
@@ -93,10 +91,10 @@ export const generateMessage = (
9391

9492
let result = head;
9593
if (body) {
96-
result += `\n\n${addBreaklinesIfNeeded(body, options.breaklineChar)}`;
94+
result += `\n\n${body}`;
9795
}
9896
if (breaking) {
99-
result += `\n\nBREAKING CHANGE :\n${addBreaklinesIfNeeded(breaking, options.breaklineChar)}`;
97+
result += `\n\nBREAKING CHANGE :\n${breaking}`;
10098
}
10199
if (footer) {
102100
result += addFooter(footer, answers.footerPrefix || singeIssuePrefix, colorize);

‎packages/cz-git/src/shared/utils/wrap.ts‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ function identity(str: string) {
77
}
88

99
interface Options {
10+
breaklineChar: string;
1011
width?: number;
1112
indent?: string;
1213
newline?: string;
@@ -15,11 +16,12 @@ interface Options {
1516
cut?: boolean;
1617
}
1718

18-
export const wrap = (str: string, options: Options) => {
19-
options = options || {};
19+
export const wrap = (str: string, options?: Options) => {
20+
options = options || { breaklineChar: "|" };
2021
if (str == null) {
2122
return str;
2223
}
24+
str = str.split(options.breaklineChar).join("\n").valueOf();
2325

2426
const width = options.width || 100;
2527
const indent = typeof options.indent === "string" ? options.indent : "";

0 commit comments

Comments
 (0)