Registry / devops / tiny-conventional-commits-parser

tiny-conventional-commits-parser

JSON →
library0.1.0jsnpmunverified

tiny-conventional-commits-parser is a JavaScript/TypeScript library specifically designed for lightweight and basic parsing of conventional commit messages. As of its current stable version, `0.1.0`, it provides essential functionalities for extracting structured information such as commit type, scope, description, and indicators for breaking changes from raw commit data or recent Git history. The package is in early but active development, evidenced by the recent `v0.1.0` feature release. A key differentiator and intentional design choice is its explicit aim *not* to provide feature or API compatibility with the more extensive `conventional-commits-parser` from the `conventional-changelog` monorepo. This makes it particularly suitable for environments or tools requiring minimal overhead and a focused approach to conventional commit parsing, without the broader feature set or potentially larger dependency footprint of alternative solutions. It ships with comprehensive TypeScript type definitions, enhancing developer experience and type safety.

npm install tiny-conventional-commits-parser
INSTALL
IMPORT
SIG · TINY-CONVENTIONAL-
T
tiny-conventional-commits-parser
devopsjavascriptv0.1.0
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

getRecentCommits
import { getRecentCommits } from 'tiny-conventional-commits-parser'
const { getRecentCommits } = require('tiny-conventional-commits-parser')
This package is ESM-first; CommonJS 'require' syntax will not work directly without transpilation or specific build configurations. It is designed to work with Git history.
parseCommit
import { parseCommit } from 'tiny-conventional-commits-parser'
const { parseCommit } = require('tiny-conventional-commits-parser')
Used for parsing individual raw commit objects into a structured conventional commit format. Ensure the input commit object structure matches expected types.

Demonstrates how to fetch recent commits from Git history between specified references and parse a raw commit object for its conventional commit structure, including breaking changes.

import { getRecentCommits, parseCommit } from 'tiny-conventional-commits-parser' async function main() { // Fetch recent commits from Git history between two refs const commitsFromHistory = await getRecentCommits('v0.0.1', 'HEAD') console.log('Recent commits from history:', commitsFromHistory.length > 0 ? commitsFromHistory[0] : 'No commits found.') // Example of a raw commit object const rawCommit = { author: { email: 'john.doe@example.com', name: 'John Doe' }, body: 'This is the commit body.\n\nFixes #123\nRelates to #456', data: new Date().toISOString(), message: 'feat(parser)!: add new parsing capabilities and fix bug with references', shortHash: 'abc1234' } // Parse a single raw commit object const parsed = parseCommit(rawCommit) console.log('\nParsed commit object:', parsed) if (parsed.isBreaking) { console.log('This is a breaking change!') } } main().catch(console.error)
Debug
Known issues
breakingThis package explicitly does not aim to provide features and APIs compatible with `conventional-commits-parser` from the `conventional-changelog` monorepo. Users expecting a drop-in replacement or similar API surface will find significant differences.
fix
Review the specific API documentation for `tiny-conventional-commits-parser` and adapt code rather than assuming compatibility with other parsers.
affects: >=0.0.1
gotchaAs a `0.x.x` version, the package is in an early stage of development. APIs and internal structures may change rapidly between minor versions without adhering to strict semantic versioning for breaking changes, though efforts will be made to document significant shifts.
fix
Pin to exact versions in production environments and thoroughly test updates. Monitor the GitHub repository for release notes.
affects: >=0.0.1
gotchaThe package focuses on basic, simple parsing of conventional commits. It may not support advanced features, highly customized commit formats, or extensive reference parsing (e.g., cross-repository links) that more comprehensive parsers might offer.
fix
Verify that the library's capabilities meet your specific parsing requirements, especially for complex commit message structures or non-standard conventions. Consider contributing or requesting features if needed.
affects: >=0.0.1
gotchaThe `v0.1.0` release introduced 'path filtering'. The precise syntax and behavior for this new feature, especially regarding multiple paths, globs, or interactions with different Git contexts, might require careful understanding to achieve desired results.
fix
Consult the latest documentation or source code for `getRecentCommits` and its path filtering options. Experiment with different path inputs in a controlled environment to confirm expected behavior.
affects: >=0.1.0
Errors
Common errors & fixes
TypeError: parseCommit is not a function
Attempting to import `parseCommit` using CommonJS `require()` syntax in an ESM-only context or without proper transpilation.
fix
Ensure your project is configured for ESM and use `import { parseCommit } from 'tiny-conventional-commits-parser'`.
Error: fatal: bad object <ref>
The `getRecentCommits` function was called with an invalid or non-existent Git reference (commit hash, tag, branch name).
fix
Verify that the provided Git references (e.e.g. 'v0.0.1', 'HEAD', 'main') are valid and accessible within the current Git repository context where the command is executed.
Commit message structure not recognized or parsed incorrectly
Passing a non-conventional commit message to `parseCommit` or a message that deviates significantly from the standard conventional commit specification.
fix
Ensure commit messages adhere strictly to the Conventional Commits specification. The parser is designed for these formats, and non-compliant messages will result in less structured output or flags like `isConventional: false`.
Upgrade
Version history
0.1.0latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
16 hits · last 30 days
node
12
OpenAI (training)
3
Resources
tiny-conventional-commits-parser — npm install tiny-conventional-commits-parser · libregistry