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

Version is being bumped by a Major increment when should be Minor #210

Open
JamesLMilner opened this issue Jan 31, 2025 · 2 comments
Open
Labels
bug Something isn't working

Comments

@JamesLMilner
Copy link

Describe the bug
I am using commit-and-tag-version in my project Terra Draw. The project is a monorepo, and has packages in the packages folder. I filter the CHANGELOG based on scopes that are the package names (terra-draw, terra-draw-leaflet-adapter etc). All seemed to be working okay, until I went to release a new version of terra-draw and I am being bumped from version 1.0.0 to what I would assume would be 1.1.0 but it is creating a change log for 2.0.0. In the CHANGELOG there are no breaking changes, and 2 feat changes (hence expecting a minor bump rather than major). I am running it like so for the dry run:

commit-and-tag-version .versionrc.cjs -t terra-draw@ --dry-run

The (condensed) version of the .versionrc.cjs file looks like this:

const path = require("path");
const packageJsonPath = path.resolve(__dirname, `package.json`);
const packageName = require(packageJsonPath).name
console.log(`✔ Package: ${packageName}`)

const changelogPath = path.resolve(__dirname, "/CHANGELOG.md")

module.exports = {
	bumpFiles: [
		{
			filename: packageJsonPath,
			type: "json",
		},
	],
	packageFiles: [packageJsonPath],
	writerOpts: {
		transform: (commit, context) => {
			// Only include commits scoped to the package
			if (!commit.scope || commit.scope !== packageName) {
				return null;
			}
			return commit;
		},
	},
	changelogFile: changelogPath,
	releaseCommitMessageFormat: `chore(${packageName}): release version {{currentTag}}`,
}

Current behavior
The packages attempts to bump to version 2.0.0 even though there are no breaking changes

Expected behavior
It bumps to version 1.1.0 as there are no breaking changes, and only feat entries

Environment

  • commit-and-tag-version version(s): 12.5.0
  • Node/npm version: Node 20.12.1, npm 10.5.0
  • OS: Mac OS v14

Possible Solution

Is there some possibility because this is a monorepo it is picking up previous historical commits somehow that don't relate to the package? Hard to say

Additional context
Here is a GitHub Action with the dry run and created CHANGELOG: https://github.com/JamesLMilner/terra-draw/actions/runs/13041702361/job/36384792942

@JamesLMilner JamesLMilner added the bug Something isn't working label Jan 31, 2025
@TimothyJones
Copy link
Member

Thanks for the report!

Could it be because your 1.0.0 tag is called [email protected], and maybe ctv isn't picking it up as relevant? If this is this case, you'd see some of the same commits in the changelog again (including the breaking change).

Either way, what, exactly, is in your changelog?

Also - does the bug reproduce with your condensed versionrc.js?

Lastly, I think your writerOpts there might only affect changelog output, not the version reasoning (potentially). I've not looked at getting it going with a monorepo. Has this configuration worked for you in the past?

@JamesLMilner
Copy link
Author

Hey @TimothyJones appreciate the response.

That is correct, it does use the tagging system of using the package name as the tag prefix. This matches the scope in the commits and also the approach that ctv suggests: https://github.com/absolute-version/commit-and-tag-version?tab=readme-ov-file#prefix-tags

To answer your question about the CHANGELOG, here is the full log it generates for the v2.0.0 release it tries to create (apologies about the length):

> [email protected] release:dryrun
> commit-and-tag-version .versionrc.cjs -t terra-draw@ --dry-run

✔ Package: terra-draw
✔ bumping version in /home/runner/work/terra-draw/terra-draw/packages/terra-draw/package.json from 1.0.0 to 2.0.0
✔ outputting changes to CHANGELOG.md

---
## [2.0.0](https://github.com/JamesLMilner/terra-draw/compare/[email protected]@2.0.0) (2025-01-2[9](https://github.com/JamesLMilner/terra-draw/actions/runs/13041702361/job/36384792942#step:8:10))


### chore

* **terra-draw:** add a step to update package-lock.json (#414) ([](https://github.com/JamesLMilner/terra-draw/commit/6a6ad95fd8e0e6700cd2b1bfb06dc1d2c6ff439b)), closes [#414](https://github.com/JamesLMilner/terra-draw/issues/414)
* **terra-draw:** add default title for documentation issues (#451) ([](https://github.com/JamesLMilner/terra-draw/commit/b59831bbeabcba321bf332d8037ff770636f5e5e)), closes [#451](https://github.com/JamesLMilner/terra-draw/issues/451)
* **terra-draw:** add release actions for all adapters (#408) ([](https://github.com/JamesLMilner/terra-draw/commit/890e9085f6cf16970cff05d6ab7ae33ac7f41f8f)), closes [#408](https://github.com/JamesLMilner/terra-draw/issues/408)
* **terra-draw:** automated update package-lock.json during CI release ([](https://github.com/JamesLMilner/terra-draw/commit/19a6f89acbce4ebba62a9c75cb449bae4e2322b2))
* **terra-draw:** automatically update root package-lock.json on release (#421) ([](https://github.com/JamesLMilner/terra-draw/commit/d5551561641eac35c6027a3a06918e0e876b2237)), closes [#421](https://github.com/JamesLMilner/terra-draw/issues/421)
* **terra-draw:** bump e2e and development private packages to terra-draw v1.0.0 (#407) ([](https://github.com/JamesLMilner/terra-draw/commit/9208d9ce155c064771dcebdac600f0937628dfa6)), closes [#407](https://github.com/JamesLMilner/terra-draw/issues/407)
* **terra-draw:** ensure terra-draw is built before trying to build adapters in releases (#4[10](https://github.com/JamesLMilner/terra-draw/actions/runs/13041702361/job/36384792942#step:8:11)) ([](https://github.com/JamesLMilner/terra-draw/commit/c0a0982c78620013e3094d1edd7fb853ba86dcc8)), closes [#410](https://github.com/JamesLMilner/terra-draw/issues/410)
* **terra-draw:** ensure that local version of commit lint is used (#430) ([](https://github.com/JamesLMilner/terra-draw/commit/5ec8e39ebfff5635dc58dc814fd9d7997d54a321)), closes [#430](https://github.com/JamesLMilner/terra-draw/issues/430)
* **terra-draw:** ensure the actions/checkout action is used in the commit-lint-prs.yml action (#429) ([](https://github.com/JamesLMilner/terra-draw/commit/b2b1a817ba81821e30c3f[11](https://github.com/JamesLMilner/terra-draw/actions/runs/13041702361/job/36384792942#step:8:12)31c01085b3a91a93b)), closes [#429](https://github.com/JamesLMilner/terra-draw/issues/429)
* **terra-draw:** fix issue with commit-lint-prs.yml GitHub action (#428) ([](https://github.com/JamesLMilner/terra-draw/commit/61994851902496b067e6cde5145074bfbe8b6300)), closes [#428](https://github.com/JamesLMilner/terra-draw/issues/428)
* **terra-draw:** fix leaflet adapter package version that does not exist for e2e package.json (#416) ([](https://github.com/JamesLMilner/terra-draw/commit/1661be48ef441368b327649dbab4660d5310ede2)), closes [#416](https://github.com/JamesLMilner/terra-draw/issues/416)
* **terra-draw:** fix small issues with releasing actions adapters (#411) ([](https://github.com/JamesLMilner/terra-draw/commit/f594e758f0c1cbf4028020d82d9c45f695f89170)), closes [#411](https://github.com/JamesLMilner/terra-draw/issues/411)
* **terra-draw:** fix tagging when releasing via actions (#4[12](https://github.com/JamesLMilner/terra-draw/actions/runs/13041702361/job/36384792942#step:8:13)) ([](https://github.com/JamesLMilner/terra-draw/commit/5933f6ced3f7b5057372f18fbc6d77eefadb0e81)), closes [#412](https://github.com/JamesLMilner/terra-draw/issues/412)
* **terra-draw:** fix the getting started guides Leaflet adapter import (#418) ([](https://github.com/JamesLMilner/terra-draw/commit/fcb749b5377545728afa41f8ef[13](https://github.com/JamesLMilner/terra-draw/actions/runs/13041702361/job/36384792942#step:8:14)d46b6f9cd0d7)), closes [#418](https://github.com/JamesLMilner/terra-draw/issues/418)
* **terra-draw:** improve the release commit message when releasing (#413) ([](https://github.com/JamesLMilner/terra-draw/commit/26bf5f136cd19c6936efb9e5e3f284f6c7afc017)), closes [#413](https://github.com/JamesLMilner/terra-draw/issues/413)
* **terra-draw:** remove package-lock.json update as part of release for now (#415) ([](https://github.com/JamesLMilner/terra-draw/commit/b121584d516905618[14](https://github.com/JamesLMilner/terra-draw/actions/runs/13041702361/job/36384792942#step:8:15)d2cef3039525e08e7c173)), closes [#4[15](https://github.com/JamesLMilner/terra-draw/actions/runs/13041702361/job/36384792942#step:8:16)](https://github.com/JamesLMilner/terra-draw/issues/415)
* **terra-draw:** remove pr-conventional-commits and use commitlint cli to validate PR titles (#427) ([](https://github.com/JamesLMilner/terra-draw/commit/14c25991aaa2b15ad892b4[16](https://github.com/JamesLMilner/terra-draw/actions/runs/13041702361/job/36384792942#step:8:17)f7a7a79f03319fd4)), closes [#427](https://github.com/JamesLMilner/terra-draw/issues/427)
* **terra-draw:** remove references to @beta from tsdocs strings (#453) ([](https://github.com/JamesLMilner/terra-draw/commit/023073583e965abe9fc19d[17](https://github.com/JamesLMilner/terra-draw/actions/runs/13041702361/job/36384792942#step:8:18)77a32714b4bb46e5)), closes [#453](https://github.com/JamesLMilner/terra-draw/issues/453)
* **terra-draw:** update javascript versions of supported libraries to be accurate in README (#409) ([](https://github.com/JamesLMilner/terra-draw/commit/7b91107eb2afe0cfaae007f75f1c7e6804a30ede)), closes [#409](https://github.com/JamesLMilner/terra-draw/issues/409)
* **terra-draw:** update package-lock.json to include new 1.0.0 adapters ([](https://github.com/JamesLMilner/terra-draw/commit/ce982a8b8ce3a666a8142e581ac63a7de088df81))
* **terra-draw:** use npm ci rather than npm install for ci actions (#431) ([](https://github.com/JamesLMilner/terra-draw/commit/eff7dd0a12b8ba9692aa0f685a11378b4116f8ce)), closes [#431](https://github.com/JamesLMilner/terra-draw/issues/431)
* **terra-draw:** use the root level README for the terra-draw package (#455) ([](https://github.com/JamesLMilner/terra-draw/commit/d93ca9bfed2e1c8f9bacbe4eb5316b0e8f1a779c)), closes [#455](https://github.com/JamesLMilner/terra-draw/issues/455)


### fix

* **terra-draw:** ensure getFeaturesAtPointerEvent has optional options properties (#454) ([](https://github.com/JamesLMilner/terra-draw/commit/5a4283653274e6c4add014a784eecb36f4d996b5)), closes [#454](https://github.com/JamesLMilner/terra-draw/issues/454)
* **terra-draw:** fix issue deleting line string coordinate points in select mode (#452) ([](https://github.com/JamesLMilner/terra-draw/commit/9e3aab16e4ce3c82bf816fb257c417f720f17baf)), closes [#452](https://github.com/JamesLMilner/terra-draw/issues/452)
* **terra-draw:** resolve issue where coordinates cannot be draggable if feature id is 0 (#423) ([](https://github.com/JamesLMilner/terra-draw/commit/b4a776c51a97d0ab8751b2c79ed21649d869a363)), closes [#423](https://github.com/JamesLMilner/terra-draw/issues/423)


### docs

* **terra-draw:** add details to the STORE guide about valid geometry types for addFeatures (#426) ([](https://github.com/JamesLMilner/terra-draw/commit/cdcb3aa2f75d9ea49dcba63a20f9caf7e79b4502)), closes [#426](https://github.com/JamesLMilner/terra-draw/issues/426)
* **terra-draw:** change two incorrect apostrophes in 7.DEVELOPMENT.md (#444) ([](https://github.com/JamesLMilner/terra-draw/commit/581adc8573900fb3[18](https://github.com/JamesLMilner/terra-draw/actions/runs/13041702361/job/36384792942#step:8:19)1030eb6b054c337ef4aa30)), closes [#444](https://github.com/JamesLMilner/terra-draw/issues/444)
* **terra-draw:** fix discrepancy in event documentation (#390) ([](https://github.com/JamesLMilner/terra-draw/commit/9a4ed7a74e64f38164ec248670b75e360ce50884)), closes [#390](https://github.com/JamesLMilner/terra-draw/issues/390)
* **terra-draw:** fix spelling and grammar issues in 2.STORE.md (#445) ([](https://github.com/JamesLMilner/terra-draw/commit/5b08dbddf85f67d0dc71897433347253921e11f8)), closes [#445](https://github.com/JamesLMilner/terra-draw/issues/445)
* **terra-draw:** fix spelling and grammar issues in 4.MODES.md (#446) ([](https://github.com/JamesLMilner/terra-draw/commit/fc39d446a4[19](https://github.com/JamesLMilner/terra-draw/actions/runs/13041702361/job/36384792942#step:8:20)35c8d5780bf8d9ffcc86b19b939f)), closes [#446](https://github.com/JamesLMilner/terra-draw/issues/446)
* **terra-draw:** fix spelling and indefinite article in 8.EXAMPLES.md (#447) ([](https://github.com/JamesLMilner/terra-draw/commit/89cfd24d3a7b90484d12631127a422efae4636c8)), closes [#447](https://github.com/JamesLMilner/terra-draw/issues/447)
* **terra-draw:** fix spelling and punctuation in 5.STYLING.md (#449) ([](https://github.com/JamesLMilner/terra-draw/commit/7aa7c944ab09d07e71521ef26349c85098da999f)), closes [#449](https://github.com/JamesLMilner/terra-draw/issues/449)


### feat

* **terra-draw:** add editable option for point mode to allow moving points whilst drawing (#443) ([](https://github.com/JamesLMilner/terra-draw/commit/9a85b89c23e3422331ab584d8b564bc08a2d8156)), closes [#443](https://github.com/JamesLMilner/terra-draw/issues/443)
* **terra-draw:** add editable option for polygon mode to allow moving polygons whilst drawing (#450) ([](https://github.com/JamesLMilner/terra-draw/commit/cf997346e76aa97c[20](https://github.com/JamesLMilner/terra-draw/actions/runs/13041702361/job/36384792942#step:8:21)a611d4a2aafe25a635379a)), closes [#450](https://github.com/JamesLMilner/terra-draw/issues/450)
---

✔ committing /home/runner/work/terra-draw/terra-draw/packages/terra-draw/package.json and CHANGELOG.md
✔ tagging release [email protected]
ℹ Run `git push --follow-tags origin main` to publish

As you can see no breaking changes are present (BREAKING CHANGE, or !).

Does ctv provide a way to influence how the release is versioned? i.e. is there a function similar to writerOpts for determining the version released?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants