@hyperfrontend/versioning/commits/modelsmodels
Conventional-commit type system: type taxonomies, breaking-change models, factories, and semver-bump derivation.
ConventionalCommit and CommitFooter are the structured shapes produced by the parser; createConventionalCommit and createCommitFooter are the canonical factories. The BreakingChange model captures whether a commit declared a breaking change via ! syntax or a BREAKING CHANGE: footer (createBreakingFromFooter, createBreakingFromSubject, createNonBreaking, isBreakingFooterKey). The CommitType taxonomy plus COMMIT_TYPES, MINOR_TYPES, PATCH_TYPES, RELEASE_TYPES, isStandardType, and isReleaseType answer the "what kind of commit is this?" questions, while getSemverBump maps a (type, breaking) pair to the corresponding BumpType.
API Reference
ƒ Functions
Parameters
| Name | Type | Description |
|---|---|---|
§description? | string | Optional description of the breaking change |
Returns
BreakingChangeExample
Creating a breaking change from subject
createBreakingFromSubject('remove deprecated API')
// => { isBreaking: true, description: 'remove deprecated API', source: 'subject' }createConventionalCommit(type: string, subject: string, options?: Partial<Omit<ConventionalCommit, "type" | "subject" | "raw">> & { raw: string }): ConventionalCommit
Parameters
Returns
ConventionalCommitExample
Creating conventional commits
createConventionalCommit('feat', 'add user authentication')
// => { type: 'feat', subject: 'add user authentication', scope: [], footers: [], breaking: false, raw: 'feat: add user authentication' }
createConventionalCommit('fix', 'resolve memory leak', { scope: ['core'], breaking: true })
// => { type: 'fix', subject: 'resolve memory leak', scope: ['core'], breaking: true, ... }
createConventionalCommit('feat', 'add x', { scope: ['versioning', 'questions'] })
// => { ..., scope: ['versioning', 'questions'], raw: 'feat(versioning,questions): add x' }Returns
BreakingChangeExample
Creating a non-breaking change
createNonBreaking()
// => { isBreaking: false, source: 'none' }Parameters
Returns
"minor" | "patch" | "none" | "major"Example
Determining semver bump level
getSemverBump('feat', false)
// => 'minor'
getSemverBump('fix', true)
// => 'major'
getSemverBump('docs', false)
// => 'none'Parameters
| Name | Type | Description |
|---|---|---|
§type | string | The commit type to check |
Returns
booleanExample
Checking for release-triggering types
isReleaseType('feat')
// => true
isReleaseType('chore')
// => falseParameters
| Name | Type | Description |
|---|---|---|
§type | string | The commit type to check |
Returns
unknownExample
Checking for standard commit types
isStandardType('feat')
// => true
isStandardType('custom')
// => false◈ Interfaces
Properties
◆ Types
type CommitType = "feat" | "fix" | "docs" | "style" | "refactor" | "perf" | "test" | "build" | "ci" | "chore" | "revert" | string