Thank you for your interest in contributing to om-data-mapper! We welcome contributions from the community and are grateful for your support.
- Code of Conduct
- Getting Started
- Development Setup
- Making Changes
- Commit Guidelines
- Pull Request Process
- Coding Standards
- Testing
- Documentation
- Getting Help
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 aleksandr.melnik.personal@gmail.com.
- Node.js 20.x or higher
- npm 10.x or higher
- Git
- Fork the repository on GitHub
- Clone your fork locally:
git clone https://github.com/YOUR_USERNAME/data-mapper.git cd data-mapper - Add the upstream repository:
git remote add upstream https://github.com/Isqanderm/data-mapper.git
-
Install dependencies:
npm install
-
Build the project:
npm run build
-
Run tests:
npm test -
Run linting:
npm run lint
-
Format code:
npm run format
npm run build- Compile TypeScript to JavaScriptnpm run build:watch- Watch mode for developmentnpm test- Run tests with coveragenpm run test:watch- Run tests in watch modenpm run lint- Check code for linting errorsnpm run lint:fix- Fix linting errors automaticallynpm run format- Format code with Prettiernpm run format:check- Check code formattingnpm run clean- Remove build artifacts
Create a new branch for your changes:
git checkout -b feature/your-feature-name
# or
git checkout -b fix/your-bug-fixBranch naming conventions:
feature/- New featuresfix/- Bug fixesdocs/- Documentation changesrefactor/- Code refactoringtest/- Test additions or modificationschore/- Maintenance tasks
- Write your code following our coding standards
- Add or update tests as needed
- Update documentation if necessary
- Ensure all tests pass:
npm test - Ensure linting passes:
npm run lint - Ensure formatting is correct:
npm run format:check
We follow Conventional Commits specification for commit messages. This enables automatic changelog generation and semantic versioning.
<type>(<scope>): <subject>
<body>
<footer>
feat: A new featurefix: A bug fixdocs: Documentation only changesstyle: Changes that don't affect code meaning (formatting, etc.)refactor: Code change that neither fixes a bug nor adds a featureperf: Performance improvementstest: Adding or updating testschore: Changes to build process or auxiliary toolsci: Changes to CI configuration files and scripts
# Feature
git commit -m "feat: add support for nested array mapping"
# Bug fix
git commit -m "fix: resolve issue with undefined values in deep mapping"
# Documentation
git commit -m "docs: update README with new examples"
# Breaking change
git commit -m "feat!: redesign mapper API
BREAKING CHANGE: The create method now requires explicit type parameters"The scope should be the name of the affected module:
mapperutilstypescideps
Example:
git commit -m "feat(mapper): add caching support"-
Update your branch with the latest changes from upstream:
git fetch upstream git rebase upstream/main
-
Ensure all checks pass:
npm run build npm test npm run lint npm run format:check -
Update documentation if needed
-
Push your branch to your fork:
git push origin feature/your-feature-name
-
Go to the repository on GitHub and create a Pull Request
-
Fill out the PR template with:
- Clear description of changes
- Related issue numbers (if applicable)
- Screenshots (if UI changes)
- Checklist completion
-
Wait for review and address feedback
- ✅ All tests pass
- ✅ Code coverage maintained or improved (blocking requirement)
- ✅ Code is linted and formatted
- ✅ Documentation is updated
- ✅ Commit messages follow conventions
- ✅ No merge conflicts
- ✅ Approved by at least one maintainer
- Use TypeScript for all new code
- Provide proper type annotations
- Avoid
anytype when possible - Use interfaces for object shapes
- Use type aliases for complex types
- Follow the existing code style
- Use meaningful variable and function names
- Keep functions small and focused
- Add comments for complex logic
- Use JSDoc for public APIs
src/
├── Mapper.ts # Main mapper class
├── interface.ts # Type definitions
├── utils.ts # Utility functions
└── index.ts # Public exports
Important: This repository has automated code coverage protection enabled. All pull requests must maintain or improve the current code coverage percentage.
- ✅ Coverage maintained or improved → PR can be merged
- ❌ Coverage decreased → PR is automatically blocked
When you submit a PR, the CI will:
- Run tests on your branch and collect coverage
- Run tests on the main branch and collect coverage
- Compare the coverage metrics
- Post a detailed comparison comment on your PR
- Block the PR from merging if coverage decreases
See the Coverage Protection Guide for detailed information on:
- How to check coverage locally
- How to identify uncovered code
- How to fix coverage issues
- Best practices for writing tests
- Write tests for all new features
- Write tests for bug fixes
- Use descriptive test names
- Follow AAA pattern (Arrange, Act, Assert)
- Ensure your tests cover all new/modified code
import { describe, it, expect } from 'vitest';
import { Mapper } from '../src';
describe('Feature Name', () => {
it('should do something specific', () => {
// Arrange
const input = { /* ... */ };
// Act
const result = Mapper.create(/* ... */).execute(input);
// Assert
expect(result).toEqual(/* ... */);
});
});# Run all tests with coverage
npm test
# Run tests in watch mode
npm run test:watch
# Run specific test file
npx vitest tests/smoke.test.tsBefore submitting your PR, verify that coverage is maintained:
# Run tests with coverage
npm test
# Open the HTML coverage report
open coverage/index.html
# Check coverage summary in terminal
# The output will show coverage percentages for:
# - Lines
# - Statements
# - Functions
# - BranchesThe HTML report will highlight:
- ✅ Green: Covered lines
- ❌ Red: Uncovered lines
⚠️ Yellow: Partially covered branches
Focus on covering the red and yellow lines in your tests.
- Add JSDoc comments for public APIs
- Include examples in documentation
- Document parameters and return types
- Explain complex algorithms
- Update README.md for new features
- Add examples for new functionality
- Keep installation instructions current
- Update API documentation section
Add examples to the example/ directory:
- Create a new directory for your example
- Include a README explaining the example
- Provide runnable code
- Check existing issues
- Search discussions
- Ask in a new discussion thread
Use the bug report template and include:
- Clear description of the issue
- Steps to reproduce
- Expected vs actual behavior
- Environment details
- Code samples
Use the feature request template and include:
- Clear description of the feature
- Use cases and benefits
- Proposed API (if applicable)
- Alternatives considered
Contributors will be recognized in:
- GitHub contributors list
- Release notes (for significant contributions)
- CHANGELOG.md
By contributing to om-data-mapper, you agree that your contributions will be licensed under the MIT License.
Thank you for contributing to om-data-mapper! 🎉