Skip to content

Commit

Permalink
chore(build): clean up release notes script
Browse files Browse the repository at this point in the history
  • Loading branch information
reed-jones committed Aug 14, 2020
1 parent 67cd648 commit 003c285
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
1 change: 1 addition & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
# Used during the build step to create release notes etc
GITHUB_TOKEN=
6 changes: 3 additions & 3 deletions build/release-notes.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ async function generateChangelog() {
.map(parseChangelogLine)
.filter(acceptableLines)
.map(formatLine)
.join("\n") || "No notable changes tracked";
.join("\n") || "No notable commits tracked";

const pkgs = [
...new Set(
Expand All @@ -32,7 +32,7 @@ async function generateChangelog() {
.map(formatDiff(tag))
.filter(Boolean)
),
];
].join("\n");

const date = new Date
const formattedDate = `${date.getFullYear()}-${`${date.getMonth() + 1}`.padStart(2, '0')}-${`${date.getDate()}`.padStart(2, '0')}`;
Expand All @@ -44,7 +44,7 @@ async function generateChangelog() {
`\n${log}`,
`\n`,
"## Packages updated in this release",
`\n${pkgs.join("\n")}\n`,
`\n${pkgs}\n`,
].join("\n");

return createRelease(tag.name, body)
Expand Down
8 changes: 4 additions & 4 deletions build/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,12 @@ export function parseChangelogLine(line) {
export function acceptableLines(line) {
if (!line) return false;
if (line.change.startsWith("wip")) return false;
if (!line.scope || !line.scope.includes("release")) return true;
return false;
if (line.scope && line.scope.includes("release")) return false;
return true;
}

export function formatLine(line) {
return `[${line.hash}]: **${line.type}${
return `- [${line.hash}]: **${line.type}${
line.scope ? `(**_${line.scope}_**)` : ""
}**: ${line.change} - (${line.author})`;
}
Expand All @@ -58,7 +58,7 @@ export function formatDiff(tag) {
manager: isForNpm ? "npm" : "composer",
}

return `[${`_${pkg.manager}_`.padEnd(10, " ")}] **${pkg.base}/${
return `- _[${`${pkg.manager}`.padEnd(8, " ")}]_ **${pkg.base}/${
pkg.package
}**@_${pkg.version}_`.toLowerCase();
}
Expand Down

0 comments on commit 003c285

Please sign in to comment.