Skip to content

programinglive/commiter

Commiter πŸš€

npm version npm downloads publish status license: MIT

A standardized commit convention and release management tool for your repository using standard-version.

Features

  • βœ… Enforced Commit Conventions - Uses Conventional Commits format
  • 🎯 Automated Versioning - Semantic versioning (major, minor, patch)
  • πŸ“ Changelog Generation - Automatic CHANGELOG.md with icons
  • πŸ”’ Git Hooks - Pre-commit and commit-msg validation via Husky
  • 🎨 Icon Support - Each commit type has a dedicated icon in releases

Installation

Install the package globally or as a dev dependency in your project:

# Install globally
npm install -g @programinglive/commiter

# Or install as dev dependency
npm install --save-dev @programinglive/commiter

# Or use npx (no installation required)
npx @programinglive/commiter

After installation in your project, the Husky hooks will be automatically set up for commit message validation.

Commit Message Format

All commits must follow the Conventional Commits specification:

<type>(<scope>): <subject>

<body>

<footer>

Commit Types with Icons

Type Icon Description Changelog Section
feat ✨ New feature ✨ Features
fix πŸ› Bug fix πŸ› Bug Fixes
perf ⚑ Performance improvement ⚑ Performance
refactor ♻️ Code refactoring ♻️ Refactors
docs πŸ“ Documentation changes πŸ“ Documentation
style πŸ’„ Code style changes πŸ’„ Styles
test βœ… Test additions/changes βœ… Tests
build πŸ—οΈ Build system changes πŸ—οΈ Build System
ci πŸ‘· CI/CD changes πŸ‘· Continuous Integration
chore 🧹 Maintenance tasks 🧹 Chores
revert βͺ Revert previous commit βͺ Reverts

Examples

# Feature
git commit -m "feat(auth): add JWT authentication"

# Bug fix
git commit -m "fix(api): resolve null pointer exception"

# Breaking change
git commit -m "feat(api)!: redesign user endpoint

BREAKING CHANGE: The user endpoint now returns different data structure"

# With scope and body
git commit -m "perf(database): optimize query performance

Reduced query time by 50% using indexed columns"

Release Commands

Patch Release (1.0.0 β†’ 1.0.1)

For bug fixes and minor changes:

npm run release:patch

Minor Release (1.0.0 β†’ 1.1.0)

For new features (backwards compatible):

npm run release:minor

Major Release (1.0.0 β†’ 2.0.0)

For breaking changes:

npm run release:major

Automatic Release

Let standard-version determine the version bump based on commits:

npm run release

What Happens During Release?

  1. πŸ§ͺ Detects your package manager and runs the test script automatically
  2. πŸ“Š Analyzes commits since last release
  3. πŸ”’ Bumps version in package.json
  4. πŸ“ Updates CHANGELOG.md with icons
  5. 🏷️ Creates a git tag
  6. πŸ’Ύ Commits changes with format: chore(release): v1.2.3 πŸš€

Push Your Release

After running a release command, push to remote:

git push --follow-tags origin main

Pre-commit Hooks

The following hooks are automatically enforced:

  • commit-msg: Validates commit message format using commitlint
  • pre-commit: Runs tests before allowing commits

Configuration Files

  • package.json - Contains standard-version configuration
  • commitlint.config.js - Commitlint rules
  • .husky/commit-msg - Commit message validation hook
  • .husky/pre-commit - Pre-commit test hook

Troubleshooting

Commit message validation fails

Ensure your commit message follows the format:

type(scope): subject

Valid types: feat, fix, docs, style, refactor, perf, test, build, ci, chore, revert

Release commits generated by standard-version such as chore(release): 1.0.0 πŸš€ are automatically ignored by commitlint.

First release

If this is your first release and you don't have a version tag yet:

npm run release -- --first-release

Running the setup command ensures the default npm test script is echo "No tests specified", preventing the Husky pre-commit hook from failing during this initial release. Replace it with your real test command once available.

Dry run

To see what would happen without making changes:

npm run release -- --dry-run

Contributing

Contributions are welcome! Please read CONTRIBUTING.md for details on our code of conduct and the process for submitting pull requests.

License

MIT License - see the LICENSE file for details.

This project is open source and free to use, modify, and distribute at your own risk.

About

Commit convention tooling for standard-version releases

Topics

Resources

License

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Packages

No packages published