Simple git client for conventional changelog packages.
Install • Usage • API
# pnpm
pnpm add @conventional-changelog/git-client conventional-commits-filter conventional-commits-parser
# yarn
yarn add @conventional-changelog/git-client conventional-commits-filter conventional-commits-parser
# npm
npm i @conventional-changelog/git-client conventional-commits-filter conventional-commits-parser
Note: conventional-commits-filter
and conventional-commits-parser
are required only if you need ConventionalGitClient#getCommits
method.
import {
GitClient,
ConventionalGitClient
} from '@conventional-changelog/git-client'
// Basic git client
const client = new GitClient(process.cwd())
await client.add('package.json')
await client.commit({ message: 'chore: release v1.0.0' })
await client.tag({ name: 'v1.0.0' })
await client.push('master')
// Conventional git client, which extends basic git client
const conventionalClient = new ConventionalGitClient(process.cwd())
console.log(await conventionalClient.getVersionFromTags()) // v1.0.0
Create a wrapper around git
CLI instance.
Get raw commits stream.
Get tags stream.
Check file is ignored via .gitignore.
Add files to git index.
Commit changes.
Create a tag for the current commit.
Get current branch name.
Push changes to remote.
Wrapper around Git CLI with conventional commits support.
getCommits(params?: ConventionalGitLogParams, parserOptions?: ParserStreamOptions, restRawArgs?: string[]): AsyncIterable<Commit>
Get parsed commits stream.
Get semver tags stream.
Get current sematic version from git tags.
MIT © Dan Onoshko