Skip to content

Commit 987107a

Browse files
danvergaraLee-W
authored andcommitted
docs(customization): add a json config file as a example for the new implementation
120
1 parent 33bfe1d commit 987107a

File tree

1 file changed

+53
-1
lines changed

1 file changed

+53
-1
lines changed

docs/customization.md

+53-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ We have two different ways to do so.
33

44
## 1. Customize in configuration file
55

6-
**This is only supported when configuring through `toml` (e.g., `pyproject.toml`, `.cz`, and `.cz.toml`)**
6+
**This is only supported when configuring through `toml` or `json` (e.g., `pyproject.toml`, `.cz.toml`, `.cz.toml`, `.cz.json`, and `cz.json`)**
77

88
The basic steps are:
99

@@ -46,6 +46,58 @@ name = "show_message"
4646
message = "Do you want to add body message in commit?"
4747
```
4848

49+
The equivalent example for a json config file:
50+
51+
```json
52+
{
53+
"commitizen": {
54+
"name": "cz_customize",
55+
"customize": {
56+
"message_template": "{{change_type}}:{% if show_message %} {{message}}{% endif %}",
57+
"example": "feature: this feature enable customize through config file",
58+
"schema": "<type>: <body>",
59+
"schema_pattern": "(feature|bug fix):(\\s.*)",
60+
"bump_pattern": "^(break|new|fix|hotfix)",
61+
"bump_map": {
62+
"break": "MAJOR",
63+
"new": "MINOR",
64+
"fix": "PATCH",
65+
"hotfix": "PATCH"
66+
},
67+
"info_path": "cz_customize_info.txt",
68+
"info": "This is customized info",
69+
"questions": [
70+
{
71+
"type": "list",
72+
"name": "change_type",
73+
"choices": [
74+
{
75+
"value": "feature",
76+
"name": "feature: A new feature."
77+
},
78+
{
79+
"value": "bug fix",
80+
"name": "bug fix: A bug fix."
81+
}
82+
],
83+
"message": "Select the type of change you are committing"
84+
},
85+
{
86+
"type": "input",
87+
"name": "message",
88+
"message": "Body."
89+
},
90+
{
91+
"type": "confirm",
92+
"name": "show_message",
93+
"message": "Do you want to add body message in commit?"
94+
}
95+
]
96+
}
97+
}
98+
}
99+
```
100+
49101
### Customize configuration
50102

51103
| Parameter | Type | Default | Description |

0 commit comments

Comments
 (0)