Contributing to nestjs-context-logger
December 4, 2024 · View on GitHub
Thank you for considering contributing to nestjs-context-logger! Whether it's fixing a bug, adding a feature, or improving documentation - all contributions are welcome.
Quick Start
- Fork and clone the repo
- Install dependencies:
npm install - Create a branch for your changes
- Make your changes
- Run tests:
npm test - Push your changes
- Open a pull request
Development Guide
Initial Setup
# Clone your fork
git clone https://github.com/YOUR_USERNAME/nestjs-context-logger.git
# Install dependencies
npm install
# Run tests to verify setup
npm test
Running Tests
# Run full test suite
npm test
# Run tests in watch mode
npm run test:watch
Testing Your Changes
The best way to test your changes is to use the logger in a real NestJS application. Here's a quick way to do that:
- Create a new NestJS app:
nest new test-app
- Link your local nestjs-context-logger:
# In nestjs-context-logger directory
npm link
# In your test app directory
npm link nestjs-context-logger
- Use it in your test app:
import { ContextLoggerModule } from 'nestjs-context-logger';
@Module({
imports: [ContextLoggerModule],
})
export class AppModule {}
Project Structure
src/
├── interfaces/ # TypeScript interfaces
├── interceptors/ # NestJS interceptors
├── store/ # Context storage implementation
└── tests/ # Test files
Guidelines
When submitting a PR:
- Make sure tests pass
- Add tests if you're adding a feature
- Update README if needed
- Update types if you're changing interfaces
Commit Messages
We follow Conventional Commits. Each commit message should be structured as follows:
-
feat: <description>- New features that add functionality
- Triggers MINOR version bump (1.1.0 → 1.2.0)
- Example:
feat: add support for custom serializers
-
fix: <description>- Bug fixes and patches
- Triggers PATCH version bump (1.1.1 → 1.1.2)
- Example:
fix: prevent context leak in concurrent requests
-
BREAKING CHANGE: <description>orfeat!: <description>- Changes that break backward compatibility
- Triggers MAJOR version bump (1.0.0 → 2.0.0)
- Example:
feat!: change logger API to async methods
-
docs: <description>- Documentation changes only
- No version bump
- Example:
docs: improve API reference section
-
test: <description>- Adding or modifying tests
- No version bump
- Example:
test: add e2e tests for Express adapter
-
refactor: <description>- Code changes that neither fix bugs nor add features
- No version bump
- Example:
refactor: simplify context storage logic
-
chore: <description>- Maintenance tasks, dependency updates, etc
- No version bump
- Example:
chore: update nestjs to v10
Need Help?
- 🐛 Open an issue
- 💬 Start a discussion
- 🤝 Ask questions in PRs
Don't worry too much about getting everything perfect. We're happy to help guide you through the process and fix any issues along the way.