Options
The preset takes a config object that customizes which commits are recognized, how they’re grouped, and how links are built. The simplest way to pass it is inline via loadPreset, alongside the preset name — the extra properties are forwarded to the preset:
import { ConventionalChangelog } from 'conventional-changelog'
const generator = new ConventionalChangelog() .readPackage() .loadPreset({ name: 'conventionalcommits', // options below })Alternatively, import the preset factory and hand its result to .config():
import createPreset from 'conventional-changelog-conventionalcommits'
generator.config(createPreset({ /* options */ }))Reference
Section titled “Reference”| Option | Type | Default | Description |
|---|---|---|---|
types | CommitType[] | default types | Commit types to recognize, the section each appears under, and its visibility. |
ignoreCommits | RegExp | Skip commits whose message matches this pattern. | |
issuePrefixes | string[] | ['#'] | Prefixes recognized as issue references and linkified in subjects. |
scope | string | string[] | Only include commits for the given scope(s); the scope is stripped from the output. | |
scopeOnly | boolean | false | With scope, also exclude commits that have no scope. |
preMajor | boolean | false | Treat the project as pre-1.0 when recommending a version bump. |
formatIssueUrl | (context, reference) => string | git-host style | Build the URL for an issue/PR reference. |
formatCommitUrl | (context, commit) => string | git-host style | Build the URL for a commit hash. |
formatCompareUrl | (context) => string | git-host style | Build the version comparison URL in the release heading. |
formatUserUrl | (context, user) => string | git-host style | Build the URL for an @user mention. |
Controls which commit types show up and where. Each entry is:
interface CommitType { type: string // commit type, e.g. "feat" section?: string // heading the commits appear under effect?: 'bump' | 'changelog' | 'hidden' // default: 'bump' scope?: string // restrict this entry to a single scope}effect decides visibility and version impact:
bump(default) — shown in the changelog and counts toward the recommended version bump.changelog— shown in the changelog, but does not affect the version bump.hidden— parsed but omitted from the changelog.
Reveal the normally-hidden docs commits under their own section, without letting them drive a release:
import createPreset, { DEFAULT_COMMIT_TYPES } from 'conventional-changelog-conventionalcommits'
createPreset({ types: DEFAULT_COMMIT_TYPES.map(entry => entry.type === 'docs' ? { ...entry, effect: 'changelog' } : entry )})Default types
Section titled “Default types”Shown by default (effect: 'bump'):
| Type | Section |
|---|---|
feat, feature | Features |
fix | Bug Fixes |
perf | Performance Improvements |
revert | Reverts |
Recognized but hidden (effect: 'hidden'): docs (Documentation), style (Styles), chore (Miscellaneous Chores), refactor (Code Refactoring), test (Tests), build (Build System), ci (Continuous Integration).
scope and scopeOnly
Section titled “scope and scopeOnly”Scope filtering is useful in monorepos where each package owns a commit scope. When scope is set, matching commits are included and the scope prefix is stripped from each entry (it’s implied by the section):
// Commits scoped to "api" — plus scopeless commitscreatePreset({ scope: 'api' })
// Only commits explicitly scoped to "api"createPreset({ scope: 'api', scopeOnly: true })
// Several scopescreatePreset({ scope: ['api', 'core'] })A commit may declare multiple comma-separated scopes (feat(api,core): …); it matches if any of them is in scope.
preMajor
Section titled “preMajor”For projects still on 0.x, preMajor: true softens the recommended bump: breaking changes bump the minor version and features bump the patch version. It affects version recommendations only, not the changelog text.
URL formatters
Section titled “URL formatters”Each formatter builds one kind of link; the defaults derive GitHub/GitLab/Bitbucket-style URLs from the repository info. Override them to target a custom host or URL scheme:
createPreset({ formatCommitUrl: (context, commit) => `https://git.example.com/${context.owner}/${context.repository}/-/commit/${commit.hash}`})| Formatter | Builds |
|---|---|
formatCompareUrl(context) | The previousTag...currentTag comparison link in the release heading. |
formatCommitUrl(context, commit) | The link on each commit’s short hash. |
formatIssueUrl(context, reference) | The link on each issue/PR reference. |
formatUserUrl(context, user) | The link on each @user mention. |