-
Notifications
You must be signed in to change notification settings - Fork 26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ci: adjust release page generation #772
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 😬 This is a lot to add for one aspect of configuration. I don't like the idea of the template including so much custom code. Part of the goal of CTA is to show off making great web dev repos without manual configuring. This is kind of the opposite. But, the feature here of having a changelog with grouped types seems very universally applicable and good to me. So much so that I think it arguably could be a first-class feature of the plugin. I.e. I think an equivalent
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah, I think that it would make sense to incorporate into I guess, would you want to wait for that to be implemented upstream, or go with something like this for now, until it's available? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think I'd prefer to wait for upstream, yeah. As much as the awkwardly chore-heavy changelogs irk me, I've been bit by people getting the 'ick' from CTA having too much configuration in it. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
module.exports = { | ||
git: { | ||
commitMessage: "chore: release v${version}", | ||
requireCommits: true, | ||
}, | ||
github: { | ||
release: true, | ||
releaseName: "v${version}", | ||
releaseNotes(context) { | ||
const groupTitles = { | ||
feat: "Features", | ||
fix: "Bug Fixes", | ||
perf: "Performance Improvements", | ||
}; | ||
const commits = context.changelog.split("\n").slice(1); | ||
const groups = Object.groupBy(commits, (commit) => { | ||
// If it matches one of the types we care to show, then add the | ||
// commit to that group. | ||
for (const type in groupTitles) { | ||
const regex = new RegExp(`^\s*[-*]?\s*${type}[(:]`); | ||
if (regex.test(commit)) { | ||
return type; | ||
} | ||
} | ||
|
||
// If it didn't match any of the important groups, then add it to other | ||
return "other"; | ||
}); | ||
|
||
// Use the data we've collected to build the release notes. | ||
const releaseNotes = []; | ||
for (const type in groupTitles) { | ||
if (groups[type]) { | ||
releaseNotes.push(`### ${groupTitles[type]}`); | ||
releaseNotes.push(...groups[type]); | ||
} | ||
} | ||
return releaseNotes.join("\n"); | ||
}, | ||
}, | ||
npm: { publishArgs: ["--access public", "--provenance"] }, | ||
plugins: { | ||
"@release-it/conventional-changelog": { | ||
infile: "CHANGELOG.md", | ||
preset: "angular", | ||
types: [ | ||
{ section: "Features", type: "feat" }, | ||
{ section: "Bug Fixes", type: "fix" }, | ||
{ section: "Performance Improvements", type: "perf" }, | ||
{ hidden: true, type: "build" }, | ||
{ hidden: true, type: "chore" }, | ||
{ hidden: true, type: "ci" }, | ||
{ hidden: true, type: "docs" }, | ||
{ hidden: true, type: "refactor" }, | ||
{ hidden: true, type: "style" }, | ||
{ hidden: true, type: "test" }, | ||
], | ||
}, | ||
}, | ||
}; |
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,6 +19,7 @@ module.exports = tseslint.config( | |
"lib", | ||
"node_modules", | ||
"pnpm-lock.yaml", | ||
".release-it.js", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If this is to exist, I'd rather it be linted with There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Or add proper types? I put a I suspect there's a feature request to be filed upstream in WDYT? |
||
], | ||
}, | ||
{ linterOptions: { reportUnusedDisableDirectives: "error" } }, | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For context, the reason I'd kept it on 18 even after 20 went LTS is to make sure scripts that actually run the code don't crash on older Node.js versions. Specifically Node.js APIs aren't checked by TypeScript the way globals or syntax are. But CTA repos now include lint rules like
n/no-unsupported-features/es-builtins
. So I think this is fine to switch for faster Node.js performance + more built-ins. 🚀