Skip to content

Latest commit

 

History

History
219 lines (157 loc) · 4.88 KB

File metadata and controls

219 lines (157 loc) · 4.88 KB

Contributing to commit-emoji

First off, thank you for considering contributing to commit-emoji! It's people like you that make commit-emoji such a great tool.

Code of Conduct

This project and everyone participating in it is governed by our Code of Conduct. By participating, you are expected to uphold this code. Please report unacceptable behavior to the project maintainers.

How Can I Contribute?

Reporting Bugs

Before creating bug reports, please check the existing issues to avoid duplicates. When you create a bug report, include as many details as possible:

  • Use a clear and descriptive title
  • Describe the exact steps to reproduce the problem
  • Provide specific examples (code samples, screenshots, etc.)
  • Describe the behavior you observed and what you expected
  • Include your environment details (OS, Node.js version, npm version)

Suggesting Enhancements

Enhancement suggestions are tracked as GitHub issues. When creating an enhancement suggestion:

  • Use a clear and descriptive title
  • Provide a detailed description of the suggested enhancement
  • Explain why this enhancement would be useful
  • Include code examples if applicable

Adding New Emoji Rules

One of the easiest ways to contribute! If you have ideas for new emoji rules:

  1. Edit src/rules.ts
  2. Add your rule following this format:
{
  emoji: '🎯',
  keywords: ['target', 'goal', 'objective'],
  filePatterns: ['*.target.ts'], // Optional
  description: 'Your description here'
}
  1. Submit a pull request with examples of when this emoji would be useful

Pull Requests

  1. Fork the repo and create your branch from main
  2. If you've added code that should be tested, add tests
  3. Ensure the test suite passes
  4. Make sure your code lints
  5. Issue that pull request!

Development Process

Setup

# Clone your fork
git clone https://github.com/yourusername/commit-emoji.git
cd commit-emoji

# Install dependencies
npm install

# Build the project
npm run build

# Link for local testing
npm link

Making Changes

  1. Create a new branch:

    git checkout -b feature/your-feature-name
  2. Make your changes following our coding standards

  3. Build and test:

    npm run build
    npm test
    npm run lint
  4. Test your changes manually:

    commit-emoji suggest
    commit-emoji list

Coding Standards

  • Use TypeScript
  • Follow the existing code style
  • Write clear, descriptive variable and function names
  • Add comments for complex logic
  • Keep functions small and focused
  • Use meaningful commit messages (with emojis, of course!)

Testing

# Run tests
npm test

# Run tests in watch mode
npm test -- --watch

# Run linter
npm run lint

# Format code
npm run format

Commit Messages

Since this is commit-emoji, we expect great commit messages! Use the tool itself:

# Stage your changes
git add .

# Get emoji suggestion
commit-emoji suggest

# Commit with emoji
git commit -m "✨ add new emoji rule for API endpoints"

Commit message format:

  • Use an appropriate emoji (use the tool to help!)
  • Start with a verb in present tense (add, fix, update, remove)
  • Keep the first line under 72 characters
  • Add detailed description if needed

Examples:

✨ add Docker-related emoji rules
🐛 fix analyzer crash on empty diffs
📝 update installation instructions
⚡ improve pattern matching performance
♻️ refactor rule scoring algorithm

Project Structure

commit-emoji/
├── src/
│   ├── analyzer.ts      # Core analysis logic
│   ├── cli.ts          # CLI interface
│   ├── git.ts          # Git operations
│   ├── index.ts        # Main exports
│   ├── rules.ts        # Emoji rules definition
│   └── types.ts        # TypeScript types
├── dist/               # Compiled output
├── package.json
├── tsconfig.json
└── README.md

Adding Features

Adding a New Emoji Rule

  1. Edit src/rules.ts
  2. Add your rule to the defaultRules array
  3. Update the emoji table in README.md
  4. Test with relevant files

Improving the Analyzer

  1. Edit src/analyzer.ts
  2. Add tests for your improvements
  3. Document the algorithm changes

Adding CLI Commands

  1. Edit src/cli.ts
  2. Follow the commander.js pattern
  3. Update README with new command usage

Release Process

(For maintainers)

  1. Update version in package.json
  2. Update CHANGELOG.md
  3. Create a git tag
  4. Push to npm:
    npm publish

Questions?

Feel free to open an issue with the question label. We're here to help!

Recognition

Contributors will be recognized in:

  • README.md contributors section
  • Release notes
  • GitHub contributors page

License

By contributing, you agree that your contributions will be licensed under the MIT License.


Thank you for contributing to commit-emoji! 🎉