Description
Description
I would like to bump the version in a package-lock.json. Currently I cannot figure out how to do this safely. A typical package-lock.json has the format:
{
"name": "my-service",
"version": "1.2.3",
"packages": {
"node_modules/another/project": {
"version": "1.2.3",
...
}
}
As per the documentation, I would like to increase the "version" inside the package.lock using the following .cz.yaml config:
commitizen:
version: 1.2.3
version_files:
- package-lock.json:version
The issue is that this will update ANY package that happens to have the version 1.2.3
or even 1.2.39
, because they all match the word "version". In this example node_modules/another/project
would also be updated
I have tried searching for a solution for this but cannot find anything in the docs for version_files
. Can you please suggest how this can be done?
Possible Solution
Alternatively, to get round this, you could specify a slice (possibly using python's slice syntax) which would modify only a range of occurrences out of all the possible matches. For example
commitizen:
version: 1.2.3
version_files:
- package-lock.json:version[:2]
This would would update the first 2 occurrences but would stop there.
If there is another solution that already exists please let me know
Additional context
No response
Additional context
No response