commitizen icon indicating copy to clipboard operation
commitizen copied to clipboard

Proposal for v3

Open woile opened this issue 4 years ago • 5 comments

Hery @Lee-W and anyone who wants to participate, I'd like to make some small breaking changes and release v3.

Goals

  • annotated tags by default. --follow-tag and date.
  • current output of bump to stderr and output of changelog to stdout using a param.

Objectives

With annotated tags by default we have information like tagger (author) and date (we care mostly about date), and when pushing using --follow-tags is pushing only annotated tags. Also git describe sees annotated tags. And allows signing tags https://stackoverflow.com/questions/4971746/why-should-i-care-about-lightweight-vs-annotated-tags/4971817#4971817

Moving the output of bump to the stderr is the proper way to handle a message that we do not expect to be piped. OTOH we want the output of the changelog generated in the stderr because it can be picked up by other tools, we could use that output to generate a Github Release.

Roadmap

  • [x] deliver --annotated-tag as flag on v2
  • [x] add changelog flag to stdout

For v3 we'd introduce the following breaking changes.

  • BREAK: make annotated tag default and --lightweight-tag
  • BREAK: make bump go to stderr.

woile avatar Jan 20 '21 16:01 woile

The tag one sounds good to me 😄 As for changing the output from stdout to stderr, I'm not sure I fully understand why we should do it. If they're not errors, shouldn't they stick to stdout?

Lee-W avatar Jan 21 '21 01:01 Lee-W

Sorry, here's a source: https://medium.com/@jdxcode/12-factor-cli-apps-dd3c227a0e46 point 4

In short: stdout is for output, stderr is for messaging.

Here's another discussion: https://unix.stackexchange.com/a/331620/258839

But yeah, I'm not sure now if it's good in our case.

My objective is to print only the incremented changelog to be able to pipe it.

Maybe we can use a separator like -------------------- between the output of the changelog and the output of bump. It would be up to the people to separate them.

Any other solutions?

woile avatar Jan 21 '21 09:01 woile

Thanks for the reference. 😃 I'm a bit busy at the moment. Might need some time to read it

Lee-W avatar Jan 22 '21 14:01 Lee-W

I didn't know others use stderr like this. Thanks for your sharing. After reading your reference and description above, I think this idea is great 🙂

Lee-W avatar Jan 24 '21 08:01 Lee-W

Okay both are done. The changelog flag I don't think it's necessary, it's okay as it is now. But among using annotated tag as default, this breaking change will also be introduced (which is super minor, but breaking at least): https://github.com/commitizen-tools/commitizen/blob/master/commitizen/commands/bump.py#L228-L231

I'll start working on this when I have some time left.

woile avatar Mar 08 '21 14:03 woile