releaser-tools icon indicating copy to clipboard operation
releaser-tools copied to clipboard

Allow overriding git-semver-tags.

Open samkelleher opened this issue 5 years ago • 2 comments

It's not possible to use the releaser tool unless you tag exactly with semver tags because it consumes the git-semver-tags package directly.

This is the line: https://github.com/conventional-changelog/releaser-tools/blob/master/packages/conventional-github-releaser/src/index.js#L50

For better or worse, I have a website project that doesn't use semver tags, but an incremental counter tag, so v1, v2, v3, v4, v18273 and so forth; and alas these are not picked up by the semver tags so I can't get nice changelogs released 😢

Even providing from/to GIT SHAs doesn't work because the git tags check is still performed regardless.

I suggest:

  • Skip tag loading when a from and to value is provided.
  • Allow passing a function that can be used for returning tag data to replace git-semver-tags

samkelleher avatar May 10 '19 15:05 samkelleher

@samkelleher, thank you for explaining your use case. I was able to confirm that the semver package used by git-semver-tags treats a tag, such as v1, as invalid:

> semver.valid(`v1`)
null
> semver.valid(`v1.0.0`)
'1.0.0'

Personally I don't have time to work on this particular feature, but I have marked the issue as help wanted in case someone is willing and able to invest the time in incorporating support for non-semver tags, such as v1, into the release tools.

hutson avatar May 28 '19 02:05 hutson

I've been working on this. Since non-semver suits my usecase, I'd preferable to use the package as is but pass in options. I've had success with this, however, the changlog outputted contains duplicate headers, due to the non-configurable line below.

This line hardcodes semver detection and cannot be changed by passing in config options: https://github.com/conventional-changelog/conventional-changelog/blob/master/packages/conventional-changelog-core/lib/merge-config.js#L25

This line uses semver by default, but can be replaced by options: https://github.com/conventional-changelog/conventional-changelog/blob/master/packages/conventional-changelog-writer/index.js#L33

So all thats needed is a config option for conventional-changelog-core and it'll all work as normal, providing you give it new regex to match tags on (/v[0-9]+\.[0-9]+(?:\.[0-9]+)?/gi; which would allow v1 and v1.2.3)

samkelleher avatar Jun 09 '19 22:06 samkelleher