@wroud/conventional-commits-parser
is a lightweight library designed to parse conventional commit messages. It provides a structured way to extract commit types, scopes, and messages according to the conventional commits specification.
- Conventional Commits Parsing: Extract commit types, scopes, and messages.
- TypeScript: Written in TypeScript for type safety and modern JavaScript support.
- Pure ESM package
Install via npm:
npm install @wroud/conventional-commits-parser @wroud/git
First, get IGitCommitInfo
using getGitCommits
from @wroud/git
:
import { getGitCommits } from "@wroud/git";
import { parseConventionalCommit } from "@wroud/conventional-commits-parser";
async function example() {
const commitGenerator = getGitCommits();
for await (const commitInfo of commitGenerator) {
const parsedCommit = parseConventionalCommit(commitInfo);
console.log(parsedCommit);
// Output: { type: 'feat', scope: 'scope', description: 'add new feature' }
}
}
example();
All notable changes to this project will be documented in the CHANGELOG file.
This project is licensed under the MIT License - see the LICENSE file for details.