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
Config.changelog set to false, still writes CHANGELOG.MD files after exiting prerelease #896
Comments
I've checked the PR that introduced The validation error message doesn't specify it as allowed though: The same~ message is still in the codebase now and thus it should be adjusted to make it clear that Since this PR only declares the new config shape etc but doesn't really implement any features I've also rechecked the code at its point in time and it seems that back then there was an changesets/packages/cli/src/commands/bump/index.js Lines 59 to 68 in 0e81790
This makes me believe that the original intention to allow By digging a little bit deeper we can also see that at some point with the new config it was working as intended because the "default"
and because it stayed used when config.changelog === false then the CHANGELOG files were never getting updated here:changesets/packages/apply-release-plan/src/index.ts Lines 87 to 90 in 93ca916
So this has accidentally regressed in this PR when TLDR: I'm confident to classify this as a bug and I would gladly accept a PR fixing this 😉 |
Thanks for the quick reply and in-depth analysis @Andarist! It really helps to see the history of the code and where this regressed. By the way, the documentation also describes this intention of using Where it states:
If I can make some time I'll definitely give this a shot. |
Affected Packages
As far as I can tell the logic of this is in
@changesets/apply-release-plan
.Problem
We have recently switched to changesets in our monorepo (very happy with it!) but we don't want to use the changelog feature (yet).
I've set
"changelog": false
in our.changeset/config.json
. This is the full config:When I exit a prerelease and run
yarn changeset version
to apply my changesets, I also end up with changelog files being created in all the packages of the monorepo. I am not sure if this happens also withoutpre
, I haven't tested that, as we only do prerelease flows.Some superficial investigation
From a quick check on the source code it seems the
getNewChangelogEntry
function correctly checks whether changelogs have been disabled to skip some initial logic, but then proceeds to return a list of packages withchangelog
s anyway.Later in the code, the bit of code that processes the list of
finalisedRelease
entries doesn't check the config either. Instead it validates the presence of the changelog attribute. E.g.changelog && changelog.length > 0
.Unless I am completely off (I only spent a few minutes reading the code), since
finalisedRelease
is partially based on the output ofgetNewChangelogEntry
, I'd guess that most probably the changelog attribute is always present and filled with something.It's not a big deal for us, we can run a
find
and delete the changelogs before committing. That said, I think quite a bit of logic runs to process changelogs and it could be entirely skipped when that setting is set to false.Proposed solution
Would be really cool if setting
changelog
tofalse
in the config.json would result in no changelogs being generated at all, just package.json updates.A quick fix could be to either skip
getNewChangelogEntry
when config.changelog is false, or double check whether changelogs have been disabled when processing the list offinalisedRelease
and skip the changelog logic there.I'd be very happy to try and fix this up, or test it if necessary.
The text was updated successfully, but these errors were encountered: