Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(types): add support for custom types #114

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
44 changes: 36 additions & 8 deletions README.md
Expand Up @@ -26,19 +26,47 @@ Like commitizen, you specify the configuration of cz-conventional-changelog thro
"defaultSubject": "",
"defaultBody": "",
"defaultIssues": "",
"types": {
...
"feat": {
"description": "A new feature",
"title": "Features"
},
...
}
"types": null,
"additionalTypes": {}
}
}
// ...
}
```

The `types` property can be used to *replace* the types defined by **conventional-commit-types**:

```json5
"config": {
"commitizen": {
"types": {
...
"feat": {
"description": "A new feature",
"title": "Features"
},
...
}
}
}
```

The `additionalTypes` property can be used to add custom types in *addition to* those defined by **conventional-commit-types**:

```json5
"config": {
"commitizen": {
"path": "./node_modules/cz-conventional-changelog",
"additionalTypes": {
"mycustomtype": {
"description": "A custom commit type for custom changes",
"title": "My Custom Changes"
}
}
}
}
```

### Environment variables

The following environment varibles can be used to override any default configuration or package.json based configuration.
Expand Down
6 changes: 5 additions & 1 deletion index.js
Expand Up @@ -6,7 +6,11 @@ var configLoader = require('commitizen').configLoader;

var config = configLoader.load() || {};
var options = {
types: config.types || conventionalCommitTypes.types,
types: Object.assign(
{},
config.types || conventionalCommitTypes.types,
config.additionalTypes
),
defaultType: process.env.CZ_TYPE || config.defaultType,
defaultScope: process.env.CZ_SCOPE || config.defaultScope,
defaultSubject: process.env.CZ_SUBJECT || config.defaultSubject,
Expand Down