@conventional-changelog/git-client
Simple git client for conventional changelog packages.
Last updated 10 months ago by dangreen .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install @conventional-changelog/git-client 
SYNC missed versions from official npm registry.

@conventional-changelog/git-client

ESM-only package NPM version Node version Dependencies status Install size Build status Coverage status

Simple git client for conventional changelog packages.


Install   •   Usage   •   API

Install

# 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.

Usage

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

API

new GitClient(cwd: string)

Create a wrapper around git CLI instance.

getRawCommits(params?: GitLogParams): AsyncIterable<string>

Get raw commits stream.

getTags(): AsyncIterable<string>

Get tags stream.

getLastTag(): Promise<string>

Get last tag.

checkIgnore(file: string): Promise<boolean>

Check file is ignored via .gitignore.

add(files: string | string[]): Promise<void>

Add files to git index.

commit(params: GitCommitParams): Promise<void>

Commit changes.

tag(params: GitTagParams): Promise<void>

Create a tag for the current commit.

getCurrentBranch(): Promise<string>

Get current branch name.

push(branch: string): Promise<void>

Push changes to remote.

verify(rev: string): Promise<string>

Verify rev exists.

getConfig(key: string): Promise<string>

Get config value by key.

new ConventionalGitClient(cwd: string)

Wrapper around Git CLI with conventional commits support.

getCommits(params?: ConventionalGitLogParams, parserOptions?: ParserStreamOptions): AsyncIterable<Commit>

Get parsed commits stream.

getSemverTags(params?: GitTagsLogParams): AsyncIterable<string>

Get semver tags stream.

getLastSemverTag(params?: GetSemverTagsParam): Promise<string>

Get last semver tag.

getVersionFromTags(params?: GetSemverTagsParams): Promise<string | null>

Get current sematic version from git tags.

License

MIT © Dan Onoshko

Current Tags

  • 2.7.0                                ...           latest (3 days ago)

11 Versions

  • 2.7.0                                ...           3 days ago
  • 2.6.0                                ...           a month ago
  • 2.5.1                                ...           10 months ago
  • 2.5.0                                ...           10 months ago
  • 2.4.0                                ...           10 months ago
  • 2.3.0                                ...           a year ago
  • 2.2.0                                ...           a year ago
  • 2.1.0                                ...           a year ago
  • 2.0.0                                ...           a year ago
  • 1.0.0                                ...           2 years ago
  • 1.0.1                                ...           2 years ago
Downloads
Today 0
This Week 0
This Month 2
Last Day 0
Last Week 2
Last Month 0
Dependencies (1)
Dev Dependencies (0)
None

Copyright 2013 - present © cnpmjs.org | Home |