Skip to content

modulify/conventional

Repository files navigation

Conventional commits toolkit

🌐 Translations

Tools for analyzing git history and creating new releases according to conventional commits specification.

Tests Status codecov

Packages

Usage example

import { Client } from '@modulify/conventional-git'
import { ReleaseAdvisor } from '@modulify/conventional-bump'
import { createWrite } from '@modulify/conventional-changelog'
import semver from 'semver'

const git = new Client()
const advisor = new ReleaseAdvisor({ git })

// 1. Get current version and recommend next one
const currentVersion = await git.version() ?? '0.0.0'
const recommendation = await advisor.advise({
  preMajor: semver.lt(currentVersion, '1.0.0')
})

if (recommendation) {
  const nextVersion = semver.inc(currentVersion, recommendation.type)

  // 2. Generate and write changelog
  const write = createWrite({ git, file: 'CHANGELOG.md' })
  await write(nextVersion)

  // 3. You can now update package.json, commit and tag
  console.log(`Next release: ${nextVersion}`)
}

About

Toolkit for conventional commits

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published