Skip to content

Updating node-calver in #22 broke this plugin #44

@macintacos

Description

@macintacos

This PR seems to have been a breaking change: #22

I was doing some testing in a repo of mine, and I was using the latest version of release-it with the version 2022.5.13 of this plugin. My .release-it.toml file looks like this:

["git"]
addUntrackedFiles      = false
commit                 = false
pushArgs               = ["--follow-tags", "--force"]
requireCleanWorkingDir = true
requireCommits         = true
requireUpstream        = false
tag                    = true
tagAnnotation          = "Release v${version}"

[github]
release     = true
releaseName = "v${version}"

["hooks"]
# Cut a new branch
"after:git:release" = [
  "git checkout -b v${version}-release",
  "git push --set-upstream origin v${version}-release",
]

["plugins"]
"@csmith/release-it-calver-plugin" = { format = "yyyy.0m.minor", increment = "calendar", fallbackIncrement = "minor" }

["metrics"]
"disableMetrics" = true

I have a single tag several commits "ago" with the version 0.0.0, so running something like release-it --release-version with the above configuration file should show something like 2024.04.0. When I install version 2022.5.13 and run release-it, it indeed runs fine, printing out the version I would expect for today based on the configuration above:

$ npm install -g @csmith/[email protected]
$ release-it --release-version
2024.04.0

When installing the latest version, it just prints out the latest tag:

$ npm install -g @csmith/[email protected]
$ release-it --release-version
0.0.0

I manually installed versions of this plugin until I found the released version that started to have problems, and it seems to have started as of Release 2022.10.14, which is where this PR bumped the node-calver version.

I've updated my code to even follow the examples provided in the README, and they don't work:

# Updated plugin to match example in README
["plugins"]
"@csmith/release-it-calver-plugin" = { format = "yyyy.mm.minor", increment = "calendar.minor" }
$ npm install -g @csmith/[email protected]
$ release-it --release-version
0.0.0

Just in case you need it, here's a run with as much debug information printed out by release-it that I could find. Notice that it is seeing other commits, but it just for whatever reason doesn't print out the correct version:

$ npm install -g @csmith/[email protected]
$ NODE_DEBUG=release-it:* release-it --release-version -VV

# Below is the output of 'release-it' by the previous command
$ git diff --quiet HEAD
$ git rev-parse --abbrev-ref HEAD
main
$ git config --get branch.main.remote
origin
$ git remote get-url origin
https://github.com/redacted/redacted.git
$ git fetch
$ git rev-parse --abbrev-ref HEAD  [cached]
$ git describe --tags --match=* --abbrev=0
0.0.0
$ git describe --tags --match=* --abbrev=0  [cached]
$ git rev-list 0.0.0..HEAD --count
13
$ git rev-parse --abbrev-ref HEAD  [cached]
$ git config --get branch.main.remote  [cached]
$ git remote get-url origin  [cached]
$ git fetch  [cached]
$ git rev-parse --abbrev-ref HEAD  [cached]
$ git describe --tags --match=* --abbrev=0  [cached]
$ git log --pretty=format:"* %s (%h)" 0.0.0...HEAD
* <redacted> (cf91419)
* <redacted> (d204328)
* <redacted> (1fc1edf)
* <redacted> (55b6abd)
* <redacted> (b03a09b)
* <redacted> (7209492)
* <redacted> (88e4cac)
* <redacted> (58075da)
* <redacted> (f558a3b)
* <redacted> (e4697e1)
* <redacted> (89b5080)
* <redacted> (084ddac)
* <redacted> (2a8642e)
0.0.0

I guess I'll just manually install the last version that works (which appears to be 2022.10.13) in the meantime, however, can this please be fixed? Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions