@wroud/conventional-commits-parser

0.1.2 • Public • Published

@wroud/conventional-commits-parser

ESM-only package NPM version

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

Features

  • Conventional Commits Parsing: Extract commit types, scopes, and messages.
  • TypeScript: Written in TypeScript for type safety and modern JavaScript support.
  • Pure ESM package

Installation

Install via npm:

npm install @wroud/conventional-commits-parser @wroud/git

Usage

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();

Changelog

All notable changes to this project will be documented in the CHANGELOG file.

License

This project is licensed under the MIT License - see the LICENSE file for details.

/@wroud/conventional-commits-parser/

    Package Sidebar

    Install

    npm i @wroud/conventional-commits-parser

    Weekly Downloads

    16

    Version

    0.1.2

    License

    none

    Unpacked Size

    9.08 kB

    Total Files

    16

    Last publish

    Collaborators

    • wroud