Improve commit message parsing

Refactor the parsing of commit messages in the `+page.svelte` file to trim unnecessary whitespace from the summary and description fields. This change makes sure the processed commit message is more readable and concise.

Changes:
- Trim the summary and description lines after slicing the message
This commit is contained in:
Nikita Galaiko 2023-03-31 08:10:12 +02:00
parent 929e008811
commit e9405f9342

View File

@ -70,8 +70,8 @@
})
.then(({ message }) => {
const firstNewLine = message.indexOf('\n');
summary = firstNewLine > -1 ? message.slice(0, firstNewLine) : message;
description = firstNewLine > -1 ? message.slice(firstNewLine + 1) : '';
summary = firstNewLine > -1 ? message.slice(0, firstNewLine).trim() : message;
description = firstNewLine > -1 ? message.slice(firstNewLine + 1).trim() : '';
})
.catch(() => {
error('Failed to generate commit message');