Generating changelog
Another thing that we need to do is add the generation of changelogs. How are we going to do that?
Simple, with commit messages! There is a tool named auto-changelog
that does exactly what it says. We can quickly set it up now:
npm install -D auto-changelog
After it's installed, we need to configure it. In order to do that we need to change our package.json
, adding these lines:
{
"auto-changelog": {
"commitLimit": false,
"template": "keepachangelog"
}
}
commitLimit
removes the limit on maximum commits per release, and template
tells the tool to use keepachangelog
format which is a changelogs specification (read more about it here).
Why this exact format and why not default? The answer is because in the next publishing lesson, we will use a Github Action that will expect exactly this format.
Another thing we need to do is add a .npmrc
file with a line to remove the default tag version prefix of v
, like this:
tag-version-prefix=""
This means we will get 0.0.1
rather than v0.0.1
. This prevents our auto-changelog tool from generating changelog logs with v
prefix, which will make them truly compatible withkeepachangelog
format.
Good. The last change to our package.json
will be in the scripts
section.
This page is a preview of The newline Guide to Creating a React Hooks Library