Description
Description
I'm using commitizen in a expo + react-native project
I do cz init and make a .cz.json like this
{
"commitizen": {
"name": "cz_conventional_commits",
"tag_format": "test-$version",
"version_scheme": "semver",
"version": "3.2.4",
"update_changelog_on_bump": true,
"version_files": [
"package.json:version",
"app.json:expo.version"
]
}
}
btw I select commitizen(default)
not npm
in source of the version
then I do cz commit
and cz bump
everything finish
version in .cz.json did update
but version in package.json and app.json not update
I'm not sure is it a bug or not,
maybe is something I missed in configuration?
or is a syntax error?
Steps to reproduce
- run
cz init
. - select
.cz.json
cz_conventional_commits(default)
commitizen(default)
Y (latest tag)
semver
n (correct tag format)
test-$version
Y (auto changelog)
enter (with no hooks)
- manually setting
version_files
in .cz.json - create new commit
- run
cz bump
Current behavior
after I setting package.json:version
and app.json:expo.version
I think these 2 files will update the correct version
same as the version in .cz.json
but not
Desired behavior
I want these 3 files update with same and correct version
- package.json (version)
- app.json (expo.version)
- .cz.json (version)
Screenshots
No response
Environment
Commitizen Version: 4.4.1
Python Version: 3.13.2 (main, Feb 4 2025, 14:51:09) [Clang 16.0.0 (clang-1600.0.26.6)]
Operating System: Darwin
Activity
kamilgajekdxc commentedon Mar 19, 2025
Hello
I have the same problem. Did you manage to fix it?
Edit
I managed to solve this problem by trial and error - it's a pity that it is not clearly described in the documentation, or cz bump does not have a debug option, which will indicate problematic elements.
In a situation where I have set the cz.toml configuration file in the root folder
in order for the versions in the listed files to be updated correctly, you should:
include the version in the cz.toml file
the version included in cz.toml must match the versions in the other files (in a situation where the versions in the files differ, they will not be updated)
Another solution was to have pyproject.toml (or the appropriate manifest for configuration) in the root folder, which contained only information about the version
cz by default searches for the location in search of the manifest file.
WinnieS0728 commentedon Mar 20, 2025
thank you for solving the problem.
I'm now using commitizen npm package and semantic-release
I will try this later.
Lee-W commentedon Mar 20, 2025
Hey, sorry for the late reply.
may I know what the format of
it needs to be in the same line like
if they're set in the version_file, we do not detect
package.json
app.json
if usingdefault
provider. we only use string matching to find the line contains stringversion
and the app versionWinnieS0728 commentedon Mar 31, 2025
hello I'm back.
sorry I've been a project deadline last week.
these is my file format.
I try the @kamilgajekdxc solution.
setting all file's with same version.
after run
cz bump
package.json is update correctly.
but app.json still not.
thanks @kamilgajekdxc , set to same version is really helpful. my package.json do update.
I found the problem.
as @Lee-W said. it will find string match.
so I add
expo.version
in myapp.json
for testingcz bump update "expo.version": "" to correct version and keep "expo": {"version": ""} in old version.
now my question is how to set the correct version property in
version_files
if version is in a nesting object.