npm.io
7.1.2 • Published 1 week agoCLI

conventional-commits-parser

Licence
MIT
Version
7.1.2
Deps
2
Size
68 kB
Vulns
0
Weekly
0
Stars
8.5K

conventional-commits-parser

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

Parse raw conventional commits.

Install

# pnpm
pnpm add conventional-commits-parser
# yarn
yarn add conventional-commits-parser
# npm
npm i conventional-commits-parser

Usage

import { CommitParser } from 'conventional-commits-parser'

const parser = new CommitParser()
const commit = parser.parse(
  'feat(scope): broadcast $destroy event on scope destruction\nCloses #1'
)

console.log(commit)
/* {
  type: 'feat',
  scope: 'scope',
  subject: 'broadcast $destroy event on scope destruction',
  header: 'feat(scope): broadcast $destroy event on scope destruction',
  footer: 'Closes #1',
  references: [{
    action: 'Closes',
    issue: '1',
    raw: '#1',
    prefix: '#',
    ...
  }],
  ...
} */

Documentation

For streams and async iterables helpers, parser options, and CLI usage, visit the documentation website.

License

MIT Steve Mao

Keywords