Skip to content
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

Add 'hallmark add' command (or similar) #84

Closed
ralphtheninja opened this issue Sep 18, 2021 · 10 comments
Closed

Add 'hallmark add' command (or similar) #84

ralphtheninja opened this issue Sep 18, 2021 · 10 comments
Labels
enhancement New feature or request

Comments

@ralphtheninja
Copy link
Collaborator

ralphtheninja commented Sep 18, 2021

When building up a changelog from scratch for an existing project with already existing history it would be handy to be able to do e.g. hallmark add x.y.z which would prepend an empty section just like hallmark bump but with the given version number. You could also have hallmark add patch | minor | major.

Once the changelog has been built, then you'd start using hallmark bump from there.

@ralphtheninja ralphtheninja added the enhancement New feature or request label Sep 18, 2021
@ralphtheninja
Copy link
Collaborator Author

Maybe even have a hallmark init command for getting started on a new changelog? Just a thought and maybe for another issue.

@vweevers
Copy link
Owner

vweevers commented Sep 18, 2021

To make this easier I'd first like to do #82 (so that we don't have to compute a diff url for the newly added release) and #81 (to simplify sorting).

I assume that if the version in hallmark add <version> is older than what's already in the changelog, we'd want to insert a release after/before the closest existing version. Which can be achieved simply by sorting the releases after insertion.

Not sure I fully understand the benefit of add <version> over bump <version>. What's the main difference? That add adds an empty release, while bump populates it with commits?

@vweevers
Copy link
Owner

Related, I've been wondering about the scope of hallmark. Is it a linter, or a changelog tool? We could fork hallmark into a separate tool for changelogs (the generated content would still follow the hallmark style, but potentially that could be configurable).

@ralphtheninja
Copy link
Collaborator Author

Not sure I fully understand the benefit of add <version> over bump <version>. What's the main difference? That add adds an empty release, while bump populates it with commits?

I was a bit confused there. For some reason I didn't use bump while adding new versions (copy pasting empty change groups from another file), but it obviously works fine to get all commits inserted and then remove/tweak them.

Maybe add should be insert instead? And it could be inserted at any point in the changelog as you suggested (good idea). Does that make sense?

@ralphtheninja
Copy link
Collaborator Author

Hmm. There's some issue while doing hallmark bump on changelogs back in time. E.g. I want to add a new release to the changelog, but it takes todays date instead of the date for the commit or tag that I'm writing the release for.

@vweevers
Copy link
Owner

Yeah, that's https://github.com/vweevers/remark-changelog/blob/873a75634d061d4e120510e16d2a0268861f1d84/index.js#L168

@vweevers
Copy link
Owner

I like insert :). It's more clearly the opposite of adding a new release. Eventually, bump and insert might just be aliases, but we'll see.

I think both these commands could use a --no-commits option so that they generate empty releases if desired.

@vweevers vweevers mentioned this issue Sep 18, 2021
9 tasks
@ralphtheninja
Copy link
Collaborator Author

I think both these commands could use a --no-commits option so that they generate empty releases if desired.

Sounds lovely!

vweevers added a commit to vweevers/remark-common-changelog that referenced this issue Nov 12, 2021
@vweevers
Copy link
Owner

vweevers commented Nov 13, 2021

I want to make it a subcommand, for extensibility and to make it clear that it operates on the changelog. And just rename bump to add because having revisited the code, and combined with the --no-commits idea, I see no reason for two separate commands. Down the line, we could have the following commands (combined with #85).

Add new minor version or existing version to changelog:

hallmark cc add minor
hallmark cc add 4.2.0

Create a changelog from scratch, either full, without content or limiting versions:

hallmark cc init
hallmark cc init --no-commits
hallmark cc init --from 3.8.6 --to 4.2.0

@vweevers vweevers mentioned this issue Nov 13, 2021
vweevers added a commit that referenced this issue Nov 13, 2021
Existing behavior remains the same, so `hallmark cc add <target>`
does the same as `hallmark bump <target>` did.

The new command is more generic however: it also supports inserting
a release into the changelog for an existing version (regardless of
whether that version is first, last or somewhere in the middle).

In addition, there's a new option `--no-commits` to skip populating
the release with commits. Effectively only creating a markdown
heading (with a version number, link and date).

Closes #84
vweevers added a commit that referenced this issue Nov 14, 2021
Previously, `hallmark bump <target>` would add a release to
`CHANGELOG.md` and fix `*.md` files. Any further arguments were
taken as file arguments, overriding the default `*.md` pattern.

Now, `hallmark cc add <target>` only touches `CHANGELOG.md` and
accepts multiple targets: `hallmark cc add 1.1.0 1.2.0` will add two
releases to `CHANGELOG.md`.

Ref #84
vweevers added a commit that referenced this issue Nov 14, 2021
Previously, `hallmark bump <target>` would add a release to
`CHANGELOG.md` and fix `*.md` files. Any further arguments were
taken as file arguments, overriding the default `*.md` pattern.

Now, `hallmark cc add <target>` only touches `CHANGELOG.md` and
accepts multiple targets: `hallmark cc add 1.1.0 1.2.0` will add two
releases to `CHANGELOG.md`.

Ref #84
@vweevers
Copy link
Owner

4.0.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants