@cenk1cenk2/cz-cc

Description
This is a direct fork of cz-conventional-changelog, while it swaps inquirer for enquirer for speed and adds autocomplete to commit types as well as reducing overall questions and making many optional.
Usage
- Install commitizen. Either globally or in the project.
# yarn
yarn global add commitizen
# npm
npm install -g commitizen
- Initiate this adapter in a project. If already initiated you can add the
--forceflag to swap this adapter with the older one.- Currently has a bit of problems with yarn workspaces do to
commitizen.
- Currently has a bit of problems with yarn workspaces do to
# yarn
commitizen init @cenk1cenk2/cz-cc --yarn --dev
# npm
commitizen init @cenk1cenk2/cz-cc --dev
- Add git-hooks with hk.
amends "package://github.com/jdx/hk/releases/download/v2.0.1/[email protected]#/Config.pkl"
hooks {
["prepare-commit-msg"] {
steps {
["commitizen"] {
fix = "git cz --hook"
interactive = true
}
}
}
}
- Add commitlint if desired.
Configuration
Install the adapter by utilizing global commitizen installation.
Configuration settings are down below.
package.json
Like commitizen, you specify the configuration of cz-conventional-changelog through the package.json's config.commitizen key.
{
// ... default values
"config": {
"commitizen": {
"path": "./node_modules/@cenk1cenk2/cz-cc",
"preset": "conventionalcommits",
"maxHeaderWidth": 100,
"maxLineWidth": 100,
"defaultType": "",
"defaultScope": "",
"defaultSubject": "",
"defaultBody": "",
"defaultIssues": "",
"types": {
...
"feat": {
"description": "A new feature",
"title": "Features"
},
...
}
}
}
// ...
}
preset selects how breaking changes are prompted for and rendered, either conventionalcommits (default) or angular. See Breaking Changes.
Environment Variables
The following environment varibles can be used to override any default configuration or package.json based configuration.
- CZ_PRESET = preset
- CZ_TYPE = defaultType
- CZ_SCOPE = defaultScope
- CZ_SUBJECT = defaultSubject
- CZ_BODY = defaultBody
- CZ_MAX_HEADER_WIDTH = maxHeaderWidth
- CZ_MAX_LINE_WIDTH = maxLineWidth
Breaking Changes
Breaking changes are declared through the additional actions of the prompt, and the preset configuration decides which of the two mechanisms are offered there. It has to match the preset the release tooling analyzes commits with.
conventionalcommits(default) offers both.breaking-markerappends the!marker after the type and the optional scope, as infeat(api)!: drop the legacy token endpoint, andbreaking-changesappends aBREAKING CHANGEfooter. The specification treats them as independent signals, so either one on its own marks the commit as breaking and selecting both is valid.angularoffersbreaking-changesalone, since the!marker is not part of its header pattern. This is the behaviour of every release before v3.
Selecting neither leaves the commit non-breaking, so an ordinary commit still skips the whole subject in one pass.
Migration to v3
conventionalcommits became the default in v3, so commits made through the adapter can now carry the ! marker in the header once breaking-marker is selected. Two things to check:
- The release tooling has to analyze commits with the
conventionalcommitspreset, otherwise the!marker is not read as a major bump.@semantic-release/commit-analyzerandcommitlintboth take apresetof their own. header-max-lengthcounts the extra character, and any tooling matching commit headers with a custom regular expression has to allow the!before the colon.
To keep the previous behaviour, pin the preset back:
{
config: {
commitizen: {
preset: 'angular'
}
}
}
Commitlint
If using the 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 overwritten by setting the 'maxHeaderWidth' configuration in package.json or the CZ_MAX_HEADER_WIDTH environment variable.