Skip to content

Commit 3a23bcd

Browse files
committed
docs(bump): add example to version file
1 parent d389330 commit 3a23bcd

File tree

1 file changed

+38
-8
lines changed

1 file changed

+38
-8
lines changed

docs/commands/bump.md

Lines changed: 38 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -470,19 +470,18 @@ Supported variables:
470470

471471
---
472472

473-
### `version_files` \*
473+
### `version_files`
474474

475475
It is used to identify the files or glob patterns which should be updated with the new version.
476-
It is also possible to provide a pattern for each file, separated by colons (`:`).
477476

478477
Commitizen will update its configuration file automatically (`pyproject.toml`, `.cz`) when bumping,
479478
regarding if the file is present or not in `version_files`.
480479

481-
\* Renamed from `files` to `version_files`.
480+
You may specify the `version_files` in your `pyproject.toml`, `.cz.toml` or `cz.toml` configuration file.
482481

483-
Some examples
482+
It is also possible to provide a pattern for each file, separated by a colon (e.g. `file:pattern`). See the below example for more details.
484483

485-
`pyproject.toml`, `.cz.toml` or `cz.toml`
484+
#### Example Configuration
486485

487486
```toml title="pyproject.toml"
488487
[tool.commitizen]
@@ -493,13 +492,44 @@ version_files = [
493492
]
494493
```
495494

496-
In the example above, we can see the reference `"setup.py:version"`.
497-
This means that it will find a file `setup.py` and will only make a change
498-
in a line containing the `version` substring.
495+
In the example configuration above, we can see the reference `"setup.py:version"`.
496+
497+
This means that it will find a file `setup.py` and will only change
498+
the lines that contain the substring `"version"`.
499+
500+
For example, if we have a file `setup.py` with the following content:
501+
502+
<!-- DEPENDENCY: repeated_version_number.json -->
503+
504+
```json title="setup.py"
505+
{
506+
"name": "magictool",
507+
"version": "1.2.3",
508+
"dependencies": {
509+
"lodash": "1.2.3"
510+
}
511+
}
512+
```
513+
514+
After running `cz bump 2.0.0`, the file will be updated to:
515+
516+
```diff title="setup.py"
517+
{
518+
"name": "magictool",
519+
- "version": "1.2.3",
520+
+ "version": "2.0.0",
521+
"dependencies": {
522+
"lodash": "1.2.3"
523+
}
524+
}
525+
```
499526

500527
!!! note
501528
Files can be specified using relative (to the execution) paths, absolute paths, or glob patterns.
502529

530+
!!! note
531+
(Historical note) This option was renamed from `files` to `version_files`.
532+
503533
---
504534

505535
### `bump_message`

0 commit comments

Comments
 (0)