What is @semantic-release/release-notes-generator?
The @semantic-release/release-notes-generator package is a plugin for the semantic-release system. It automates the generation of release notes based on your project's commit history, adhering to the Semantic Versioning specification. This tool parses commit messages, groups them into sections, and formats them into a markdown document, which can then be used in release documentation.
What are @semantic-release/release-notes-generator's main functionalities?
Generate release notes
This feature automates the creation of release notes from commits. The code sample shows how to use the release-notes-generator in a Node.js script to generate release notes by providing plugin configuration and context.
const generateNotes = require('@semantic-release/release-notes-generator');
async function generateReleaseNotes(pluginConfig, context) {
const notes = await generateNotes(pluginConfig, context);
console.log(notes);
}
Other packages similar to @semantic-release/release-notes-generator
conventional-changelog
Like @semantic-release/release-notes-generator, conventional-changelog generates changelogs and release notes from a project's commit messages, following the conventional commit format. It offers more extensive customization options and plugins for different release systems, making it versatile but potentially more complex to configure.
lerna-changelog
Lerna-changelog is specifically designed for monorepos managed with Lerna and generates changelogs based on PR titles and labels. It's less flexible than @semantic-release/release-notes-generator for non-monorepo projects but is an excellent fit for projects using Lerna.
release-notes-generator
Customizable release-notes-generator plugin for semantic-release based on conventional-changelog
Options
By default release-notes-generator
uses the angular
format described in Angular convention.
Additional options can be set within the plugin definition in package.json
to use a different commit format and to customize it:
{
"release": {
"generateNotes": {
"preset": "angular",
"parserOpts": {
"noteKeywords": ["BREAKING CHANGE", "BREAKING CHANGES", "BREAKING"]
},
"writerOpts": {
"commitsSort": ["subject", "scope"],
}
}
}
}
NOTE: options.config
will be overwritten by the values of preset. You should use either preset
or config
, but not both. Individual properties of parserOpts
and writerOpts
will overwrite ones loaded with preset
or config
.
Parser Options
Allow to overwrite specific conventional-commits-parser options. This is convenient to use a conventional-changelog preset with some customizations without having to create a new module.
The following example uses Angular convention but will consider a commit to be a breaking change if it's body contains BREAKING CHANGE
, BREAKING CHANGES
or BREAKING
. By default the preset checks only for BREAKING CHANGE
and BREAKING CHANGES
.
{
"release": {
"generateNotes": {
"preset": "angular",
"parserOpts": {
"noteKeywords": ["BREAKING CHANGE", "BREAKING CHANGES", "BREAKING"],
}
}
}
}
Writer Options
Allow to overwrite specific conventional-commits-writer options. This is convenient to use a conventional-changelog preset with some customizations without having to create a new module.
The following example uses Angular convention but will sort the commits in the changelog by subject
then scope
. By default the preset sort the commits in the changelog by scope
then subject
.
{
"release": {
"generateNotes": {
"preset": "angular",
"writerOpts": {
"commitsSort": ["subject", "scope"],
}
}
}
}
Usage
The plugin is used by default by semantic-release so installing it is not necessary and all configuration are optionals.