Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(release)!: rewrite ChangelogRenderer to a class API and remove d…
…eprecated config (#28229) BREAKING CHANGE In Nx v19, implementing a custom changelog renderer would involve a lot of work on the user side. They would need to create an additional function making every property available in its declaration and then call the underlying default one and customize the final string (or reimplement the whole thing). E.g. ```js const changelogRenderer = async ({ projectGraph, commits, releaseVersion, project, entryWhenNoChanges, changelogRenderOptions, repoSlug, conventionalCommitsConfig, changes, }) => { const defaultChangelog = await defaultChangelogRenderer({ projectGraph, commits, releaseVersion, project, entryWhenNoChanges, changelogRenderOptions, repoSlug, conventionalCommitsConfig, changes, }); // ...Do custom stuff and return final string... }; module.exports = changelogRenderer; ``` In Nx v20, changelog renderer are classes. The DefaultChangelogRenderer can therefore easily and granularly be extended and customized, and the config does not need to be redeclared on the user side at all. We will improve things even further in this area, but this breaking change is an important stepping stone. E.g. for manipulating the final string equivalent to the previous example: ```js module.exports = class CustomChangelogRenderer extends ( DefaultChangelogRenderer ) { async render() { const defaultChangelogEntry = await super.render(); // ...Do custom stuff and return final string... } }; ``` E.g. for customizing just how titles get rendered: ```js class CustomChangelogRenderer extends DefaultChangelogRenderer { renderVersionTitle(): string { return 'Custom Version Title'; } } ```
- Loading branch information