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

non-semver tags not working #81

Closed
mllocs opened this issue Dec 21, 2018 · 4 comments
Closed

non-semver tags not working #81

mllocs opened this issue Dec 21, 2018 · 4 comments

Comments

@mllocs
Copy link

mllocs commented Dec 21, 2018

I'm trying to use auto-changelog in a project where releases are tagged as MAJOR.MINOR, so, only two digits.

This format doesn't look to be semver valid so I tried to use the --tag-pattern .+ option but I get an error when trying to generate the CHANGELOG:

auto-changelog: Generating changelog…TypeError: Invalid Version: 22.0
    at new SemVer (~/.nvm/versions/node/v9.2.0/lib/node_modules/auto-changelog/node_modules/semver/semver.js:312:11)
    at compare (~/.nvm/versions/node/v9.2.0/lib/node_modules/auto-changelog/node_modules/semver/semver.js:585:10)
    at Function.rcompare (~/.nvm/versions/node/v9.2.0/lib/node_modules/auto-changelog/node_modules/semver/semver.js:595:10)
    at sortReleases (~/.nvm/versions/node/v9.2.0/lib/node_modules/auto-changelog/lib/releases.js:77:46)
    at Array.sort (native)
    at Array.sort (~/.nvm/versions/node/v9.2.0/lib/node_modules/auto-changelog/node_modules/core-js/modules/es6.array.sort.js:21:15)
    at _callee$ (~/.nvm/versions/node/v9.2.0/lib/node_modules/auto-changelog/lib/run.js:172:84)
    at tryCatch (~/.nvm/versions/node/v9.2.0/lib/node_modules/auto-changelog/node_modules/regenerator-runtime/runtime.js:62:40)
    at Generator.invoke [as _invoke] (~/.nvm/versions/node/v9.2.0/lib/node_modules/auto-changelog/node_modules/regenerator-runtime/runtime.js:288:22)
    at Generator.prototype.(anonymous function) [as next] (~/.nvm/versions/node/v9.2.0/lib/node_modules/auto-changelog/node_modules/regenerator-runtime/runtime.js:114:21)

Looks like the issue happens when auto-changelog tries to sort the Releases: https://github.com/CookPete/auto-changelog/blob/a88facbb2e8c283c3e0dc57d850ad0fd6318bcde/src/releases.js#L42

I'm using [email protected].

@mllocs
Copy link
Author

mllocs commented Dec 21, 2018

I tried commenting the .sort(sortReleases) part and it works fine, and tags are already sorted by date. I don't know what would be the best fix for this (in case you want to support non-semver tags), let me know and I can help with a proper fix.

mllocs@6ce4b26

@herchu
Copy link

herchu commented Jan 14, 2019

+1 to this issue.

I have a similar use case, our versions differ even more from what semver expects. I did a pull request last year with a flag to completely ignore semver formatting. See #70
That was not incorporated to master, as the --tag-pattern would be able to handle that case.

However, --tag-pattern is not enough if the sorting of versions still relies on parsing the tags with semver. @cookpete you may remember that PR. Did you have the sort() issue in mind when adding the --tag-pattern? Is there any way to ignore semver or use different version sorting? I would be happy to re-take that PR, or send a new one with this individual line that @mllocs suggests in a new PR too.

thank you!

@cookpete
Copy link
Owner

Apologies for the delay on this. This should be fixed in 1.11.0. It was an oversight on my part when adding the --tag-pattern option, and none of the tests were comparing two non-semver tags so it slipped under the radar.

@herchu
Copy link

herchu commented Feb 5, 2019

Just to confirm - this was actually enabled and works from 1.11.0+. Thanks @cookpete !

mattlyons0 pushed a commit to mattlyons0/auto-changelog that referenced this issue Feb 14, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants