Skip to content

Commit e0e9fc3

Browse files
committed
feat(types): add support for custom types
1 parent aae2548 commit e0e9fc3

File tree

2 files changed

+20
-3
lines changed

2 files changed

+20
-3
lines changed

README.md

+19-2
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,30 @@ Like commitizen, you specify the configuration of cz-conventional-changelog thro
3333
"title": "Features"
3434
},
3535
...
36-
}
36+
},
37+
"additionalTypes": {}
3738
}
3839
}
3940
// ...
4041
}
4142
```
43+
44+
The `additionalTypes` property can be used to add custom types in addition to those defined by **conventional-commit-types**:
45+
46+
```
47+
"config": {
48+
"commitizen": {
49+
"path": "./node_modules/cz-conventional-changelog",
50+
"additionalTypes": {
51+
"mycustomtype": {
52+
"description": "A custom commit type for custom changes",
53+
"title": "My Custom Changes"
54+
}
55+
}
56+
}
57+
}
58+
```
59+
4260
### Environment variables
4361

4462
The following environment varibles can be used to override any default configuration or package.json based configuration.
@@ -53,4 +71,3 @@ The following environment varibles can be used to override any default configura
5371
### Commitlint
5472

5573
If using the [commitlint](https://github.com/conventional-changelog/commitlint) js library, the "maxHeaderWidth" configuration property will default to the configuration of the "header-max-length" rule instead of the hard coded value of 100. This can be ovewritten by setting the 'maxHeaderWidth' configuration in package.json or the CZ_MAX_HEADER_WIDTH environment variable.
56-

index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ var configLoader = require('commitizen').configLoader;
66

77
var config = configLoader.load() || {};
88
var options = {
9-
types: config.types || conventionalCommitTypes.types,
9+
types: Object.assign({}, config.types || conventionalCommitTypes.types, config.additionalTypes),
1010
defaultType: process.env.CZ_TYPE || config.defaultType,
1111
defaultScope: process.env.CZ_SCOPE || config.defaultScope,
1212
defaultSubject: process.env.CZ_SUBJECT || config.defaultSubject,

0 commit comments

Comments
 (0)