Skip to content

Commit

Permalink
feat(types): add support for additional custom types
Browse files Browse the repository at this point in the history
This implementation does not overwrite all existing types.
  • Loading branch information
adrianschmidt committed May 5, 2020
1 parent aae2548 commit 1731a9e
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 2 deletions.
20 changes: 19 additions & 1 deletion README.md
Expand Up @@ -33,12 +33,30 @@ Like commitizen, you specify the configuration of cz-conventional-changelog thro
"title": "Features"
},
...
}
},
"additionalTypes": {}
}
}
// ...
}
```

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

```
"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

0 comments on commit 1731a9e

Please sign in to comment.