Skip to content

Commit 7935e3a

Browse files
fix: footer messages
1 parent 077018f commit 7935e3a

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

src/prompts/footer-maker.ts

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ export function validatorFactory(rules: Rules) {
1515
value: value + breaking,
1616
rule: rules['footer-max-length'],
1717
validator: maxLengthValidator,
18-
message: length => 'Footer maximum length of ${length} has been exceeded'
18+
message: length => `Footer maximum length of ${length} has been exceeded`
1919
},
2020
{
2121
value: value + breaking,
@@ -40,24 +40,26 @@ export function filterFactory(rules: Rules, prefix = '') {
4040
export function breakingChangeMessageFactory(rules: Rules) {
4141
return () => {
4242
const maxLength = valueFromRule(rules['footer-max-length']);
43+
const MESSAGE = 'Describe the breaking changes';
4344

4445
if (!maxLength) {
45-
return `Describe the breaking changes:\n`;
46+
return `${MESSAGE}:\n`;
4647
}
4748

48-
return `Describe the breaking changes:\n (max ${maxLength} chars):\n`;
49+
return `${MESSAGE} (max ${maxLength} chars):\n`;
4950
};
5051
}
5152

5253
export function issuesMessageFactory(rules: Rules) {
5354
return () => {
5455
const maxLength = valueFromRule(rules['footer-max-length']);
56+
const MESSAGE = 'Add issue references (e.g. "fix #123", "re #123".)';
5557

5658
if (!maxLength) {
57-
return `Add issue references (e.g. "fix #123", "re #123".):\n`;
59+
return `${MESSAGE}:\n`;
5860
}
5961

60-
return `List issues fixed:\n (max ${maxLength} chars):\n`;
62+
return `${MESSAGE} (max ${maxLength} chars):\n`;
6163
};
6264
}
6365

@@ -92,7 +94,7 @@ export function issuesTransformerFactory(rules: Rules) {
9294
}
9395

9496
export function footerMaker(questions: Question[], rules: Rules): Question[] {
95-
const breakingQuestions: Question[] = [
97+
const footerQuestions: Question[] = [
9698
{
9799
type: 'confirm',
98100
name: 'isBreaking',
@@ -126,5 +128,5 @@ export function footerMaker(questions: Question[], rules: Rules): Question[] {
126128
}
127129
];
128130

129-
return [...questions, ...breakingQuestions];
131+
return [...questions, ...footerQuestions];
130132
}

0 commit comments

Comments
 (0)