Skip to content

Commit

Permalink
feat!: reformat changelog output
Browse files Browse the repository at this point in the history
The new output looks like: "#PR (USER): MESSAGE"

closes #19
  • Loading branch information
mheob committed Apr 13, 2023
1 parent e86b0ad commit 7fcecaf
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
5 changes: 5 additions & 0 deletions .changeset/cuddly-carrots-train.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@mheob/changeset-changelog': major
---

reformat the changelog output to displzy first the PR and user
9 changes: 4 additions & 5 deletions src/getReleaseLine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ function getUserLink(usersFromSummary: string[], user?: string) {
.trim()
: user;

return userLink ? `by ${userLink}` : undefined;
return userLink ? `(${userLink})` : '';
}

// add links to issue hints (fix #123) => (fix [#123](https://....))
Expand Down Expand Up @@ -120,12 +120,11 @@ export const getReleaseLine: GetReleaseLine = async (changeset, _type, options)

const prMessage = pull ? `(${pull})` : '';
const commitMessage = commit ? `(${commit})` : '';
const userLinkMessage = userLink ?? '';
// istanbul ignore next: because of our mocked get-github-info -- @preserve
const printPrOrCommit = pull !== '' ? prMessage : commitMessage;
const suffix = printPrOrCommit.trim() ? ` --> ${printPrOrCommit.trim()} ${userLinkMessage}` : '';
const printPrOrCommit = (pull !== '' ? prMessage : commitMessage).trim();
const prefix = printPrOrCommit ? `${printPrOrCommit} ${userLink}: ` : '';

const futureLinesMessage = futureLines.map((line) => ` ${line}`).join('\n');

return `\n\n- ${firstLine}${suffix}\n${futureLinesMessage}`;
return `\n\n- ${prefix}${firstLine}\n${futureLinesMessage}`;
};

0 comments on commit 7fcecaf

Please sign in to comment.