From aae2548e682683d8637d0ee58bd4e8f320ba3a11 Mon Sep 17 00:00:00 2001 From: Amaury Tobias Quiroz Date: Mon, 4 May 2020 16:07:56 -0500 Subject: [PATCH] feat(types): add suport for custom types (#104) --- README.md | 20 ++++++++++++++------ index.js | 2 +- 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index ffc9691b..b59d9c90 100644 --- a/README.md +++ b/README.md @@ -17,25 +17,33 @@ Like commitizen, you specify the configuration of cz-conventional-changelog thro { // ... default values "config": { - "commitizen": { + "commitizen": { "path": "./node_modules/cz-conventional-changelog", "maxHeaderWidth": 100, "maxLineWidth": 100, "defaultType": "", - "defaultScope": "", + "defaultScope": "", "defaultSubject": "", "defaultBody": "", - "defaultIssues": "" + "defaultIssues": "", + "types": { + ... + "feat": { + "description": "A new feature", + "title": "Features" + }, + ... + } } } -// ... +// ... } -``` +``` ### Environment variables The following environment varibles can be used to override any default configuration or package.json based configuration. -* CZ_TYPE = defaultType +* CZ_TYPE = defaultType * CZ_SCOPE = defaultScope * CZ_SUBJECT = defaultSubject * CZ_BODY = defaultBody diff --git a/index.js b/index.js index de9d3a30..d86155bc 100644 --- a/index.js +++ b/index.js @@ -6,7 +6,7 @@ var configLoader = require('commitizen').configLoader; var config = configLoader.load() || {}; var options = { - types: conventionalCommitTypes.types, + types: config.types || conventionalCommitTypes.types, defaultType: process.env.CZ_TYPE || config.defaultType, defaultScope: process.env.CZ_SCOPE || config.defaultScope, defaultSubject: process.env.CZ_SUBJECT || config.defaultSubject,