From 2d2cc0a9ba68832a6182c50d3040b4903531134b Mon Sep 17 00:00:00 2001 From: Chris Barth Date: Wed, 12 May 2021 10:18:39 -0400 Subject: [PATCH] Improve changelog format (#587) --- .grenrc.js | 44 +++++++++++++++++++++++++++++++++++++++++++- .release-it.json | 9 +++++++++ package-lock.json | 2 +- package.json | 9 ++------- 4 files changed, 55 insertions(+), 9 deletions(-) create mode 100644 .release-it.json diff --git a/.grenrc.js b/.grenrc.js index 1e50037c..d9a0099f 100644 --- a/.grenrc.js +++ b/.grenrc.js @@ -3,12 +3,37 @@ module.exports = { prefix: "", onlyMilestones: false, ignoreTagsWith: ["v0.32.0", "0.0.3"], + ignoreLabels: [ + "semver-major", + "semver-minor", + "semver-patch", + "closed", + "breaking-change", + "bug", + "enhancement", + "dependencies", + ], tags: "all", - groupBy: false, + groupBy: { + "Major Changes": ["semver-major", "breaking-change"], + "Minor Changes": ["semver-minor", "enhancement"], + Dependencies: ["dependencies"], + "Bug Fixes": ["semver-patch", "bug"], + Other: ["..."], + }, changelogFilename: "CHANGELOG.md", username: "node-saml", repo: "passport-saml", template: { + issue: function (placeholders) { + const parts = [ + "-", + placeholders.labels, + placeholders.name, + `[${placeholders.text}](${placeholders.url})`, + ]; + return parts.filter((_) => _).join(" "); + }, release: function (placeholders) { let dateParts = placeholders.date.split("/"); let placeholdersDate = new Date( @@ -17,7 +42,24 @@ module.exports = { Number(dateParts[0]) ); let isoDateString = placeholdersDate.toISOString().split("T")[0]; + placeholders.body = placeholders.body.replace( + "*No changelog for this release.*", + "\n_No changelog for this release._" + ); return `## ${placeholders.release} (${isoDateString})\n${placeholders.body}`; }, + group: function (placeholders) { + const iconMap = { + Enhancements: "🚀", + "Minor Changes": "🚀", + "Bug Fixes": "🐛", + Documentation: "📚", + "Technical Tasks": "⚙️", + "Major Changes": "💣", + Dependencies: "🔗", + }; + const icon = iconMap[placeholders.heading] || "🙈"; + return "\n#### " + icon + " " + placeholders.heading + ":\n"; + }, }, }; diff --git a/.release-it.json b/.release-it.json new file mode 100644 index 00000000..d22c49f8 --- /dev/null +++ b/.release-it.json @@ -0,0 +1,9 @@ +{ + "github": { + "release": true, + "releaseName": "v${version}" + }, + "hooks": { + "after:bump": "npm run changelog" + } +} diff --git a/package-lock.json b/package-lock.json index fe715332..cbc16f81 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "passport-saml", - "version": "2.0.6", + "version": "2.2.0", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 256e6704..b70b61b7 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "passport-saml", - "version": "2.0.6", + "version": "2.2.0", "description": "SAML 2.0 authentication strategy for Passport", "keywords": [ "saml", @@ -42,6 +42,7 @@ "prettier-check": "prettier --config .prettierrc.json --check .", "prettier-format": "prettier --config .prettierrc.json --write .", "prettier-watch": "onchange -k -p 100 \".\" -- prettier --config .prettierrc.json --write {{file}}", + "release": "release-it", "test": "npm run prettier-check && npm run lint && npm run tsc && mocha", "test-watch": "mocha --watch", "tsc": "tsc", @@ -92,11 +93,5 @@ }, "engines": { "node": ">= 12" - }, - "release-it": { - "github": { - "release": true, - "releaseName": "v${version}" - } } }