geut / chan

A Changelog CLI based on http://keepachangelog.com/
ISC License
87 stars 10 forks source link

"Cannot read property 'replace' of undefined" when running "chan release" with `git-template` set #64

Closed JacobDB closed 2 years ago

JacobDB commented 3 years ago

I keep getting the below error when trying to generate a release, using any version number on a new project... steps to reproduce:

  1. echo '{ "git-template": "https://gitlab.com/namespace/project/compare/[prev]...[next]" }' > .chanrc
  2. chan init
  3. chan changed "Some message"
  4. chan release 0.1.0

image

elmasse commented 3 years ago

Hi @JacobDB,

Thanks for reporting this issue.

Could you add more information about your setup (OS version, shell, etc)?

Also, are you running this in a git folder? The release command needs the git repo information which is parsed from the git structure info. Could you confirm? I'll left this issue open in any case, since we need to add more information for such a obscure error message.

Thanks!

JacobDB commented 3 years ago

Running in the root of a git repository, this has definitely worked in the past so it must be from a more recent update

Just in case you're not familiar with WSL, I figure I should explain: The Windows Subsystem for Linux allows you to run a Linux distro (Ubuntu in my case) on top of Windows, so that you can run Linux software. Generally, it works identically to an actual Linux distro, although a bit slower at times. There are occasionally differences between WSL and proper Linux, but the issues I've experienced are few and far between. So effectively, while I'm running chan on Windows, technically I'm running it on Linux.

Let me know if you need any more info.

JacobDB commented 3 years ago

Also, if you already have a release in a CHANGELOG, it seems to work fine. So for existing projects, it's not an issue, and I can typically fix it by manually creating the first release. That makes me think it's looking for like a "previous version" that doesn't exist or something along those lines.

elmasse commented 3 years ago

@JacobDB

I just released a patch version v3.2.1 which should get this issue fixed. The main cause was related to a library we are using and a change in the API getting different source name for gitlab causing a mismatch in our providers map.

Thanks for reporting the issue!

JacobDB commented 3 years ago

Awesome, thank you!

JacobDB commented 3 years ago

I still seem to be getting this error, just installed 3.2.2

tinchoz49 commented 2 years ago

Hey @JacobDB I could reproduce the error only in non git projects. From now on if you need to setup the git-template in .chanrc it would be required also to define the git-release-template that means the url for the tag version, e.g.: https://gitlab.com/[full_name]/-/tags/[next]

JacobDB commented 2 years ago

Sorry for the late response, I just got so used to working around this lol... it seems to be fixed after specifying my configuration like so:

{
    "allow-prerelease": true,
    "merge-prerelease": true,
    "git-branch": "master",
    "git-release-template": "https://gitlab.mydomain.com/{$group}/{$project}/-/tags/[next]",
    "git-template": "https://gitlab.mydomain.com/{$group}/{$project}/compare/[prev]...[next]"
}