Closed timothymarois closed 3 years ago
Make sure that you have a CHANGELOG.md
file with some content in it:
# Changelog
## [Unreleased]
### Added
- Keep-a-changelog plugin added.
I guess that your changelog file is empty at the moment. I would suggest you to also set strictLatest
to false
for now.
Got it. Thanks for the reply. I'll try that out. Yeah I tried an empty changelog and then one filled by the default settings, after adding this plugin it didnt work on any of them, I think that should be added to the docs on whats needed if it doesnt auto-populate the Unreleased, kind of odd everything else auto-populates but this one requires a manual process.
Just tried based on the changelog you sent, and it replaced unreleased too
# Changelog
## [1.0.11] - 2021-01-08
### Added
- Keep-a-changelog plugin added.
and now when I run it again, it fails with the same error message.
Re-opening because this package isn't self-explanatory
I also noticed that strictLatest : false
made no difference.
Edit:
Tried replacing the template
to use https://raw.githubusercontent.com/release-it/release-it/master/templates/keepachangelog.hbs, and there was no change. At the moment, this keep a changelog is unusable in any form.
Here is the .release-it.json
{
"github": {
"release": true,
"releaseName": "v${version}"
},
"git": {
"changelog": "npx auto-changelog --stdout --commit-limit false --unreleased --template https://raw.githubusercontent.com/release-it/release-it/master/templates/changelog-compact.hbs",
"commitMessage": "v${version} release",
"requireCleanWorkingDir": false,
"addUntrackedFiles": false,
"commit": true,
"push": true,
"tagAnnotation": "Release v${version}",
"tagName": "v${version}"
},
"npm" : {
"publish" : false
},
"hooks": {
"after:bump": "npx auto-changelog -p"
},
"plugins": {
"@release-it/keep-a-changelog": {
"filename": "CHANGELOG.md",
"strictLatest" : false
}
}
}
and again, the template change had absolutely no effect.
Developers maintain their change log file differently. Some of them generate it from git history. This is how Auto-changelog works as far as I understand. I can't really confirm because I haven't tried it.
But some developers maintain their change logs manually by entering changes under "unreleased" section in CHANGELOG.md
alongside with pull/merge requests. When releasing time comes, change log file is already prepared. You just need to change this line ## [Unreleased]
into ## [2.1.5] - 2021-01-8
and you are good to go. This plugin makes this step for you automatically.
If this line ## [Unreleased]
is missing in the CHANGELOG.md
file, then you will get ERROR Missing "Unreleased" section in CHANGELOG.md.
.
Sorry, I closed the ticket by mistake. :)
Anyway, I am trying to say that you are combining both approaches. I highly doubt that these two are compatible looking from release-it
package perspective.
Take a moment and also read the origins of this plugin here: https://github.com/release-it/release-it/issues/662
I see. so if I understand. the keep a changelog is so that I can manually add my own changes such as added, changed, fixed etc, and this just replaces [Unreleased] to the version # when I release it? If so, that makes sense. I was just unaware, I thought this was a combined approach, but it makes sense now.
There is no way around this error so far. When this plugin is added, and following instructions on the readme, this error prevents the releases.
ERROR Missing "Unreleased" section in CHANGELOG.md.
Adding the plugin: Removing the plugin and everything works again.