From 1731a9e68c97078f3eb5167a9a4f874df350b185 Mon Sep 17 00:00:00 2001 From: Adrian Schmidt Date: Tue, 5 May 2020 09:43:55 +0200 Subject: [PATCH] feat(types): add support for additional custom types This implementation does not overwrite all existing types. --- README.md | 20 +++++++++++++++++++- index.js | 6 +++++- 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index b59d9c90..a4143d0a 100644 --- a/README.md +++ b/README.md @@ -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. diff --git a/index.js b/index.js index d86155bc..02ec59e4 100644 --- a/index.js +++ b/index.js @@ -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,