Contributing to TypeORM Scopes
Thank you for your interest in contributing! This guide will help you get started.
Getting Started
Prerequisites
- Node.js 16 or higher
- npm or yarn
- Git
Setup
- Fork the repository
- Clone your fork:bash
git clone https://github.com/aramyounis/typeorm-query-scopes.git cd typeorm-query-scopes - Install dependencies:bash
npm install - Build the project:bash
npm run build - Run tests:bash
npm test
Development Workflow
Making Changes
Create a new branch:
bashgit checkout -b feature/your-feature-nameMake your changes
Build and test:
bashnpm run build npm testCommit your changes:
bashgit add . git commit -m "Description of changes"Push to your fork:
bashgit push origin feature/your-feature-nameOpen a Pull Request
Code Style
- Use TypeScript
- Follow existing code style
- Add JSDoc comments for public APIs
- Keep functions focused and small
- Write descriptive variable names
Testing
- Add tests for new features
- Ensure all tests pass
- Aim for high code coverage
- Test edge cases
Example test:
typescript
describe('ScopedRepository', () => {
it('should apply single scope', async () => {
const users = await userRepo.scope('verified').find();
expect(users.every(u => u.isVerified)).toBe(true);
});
});Documentation
Updating Docs
Documentation is in the docs/ directory using VitePress.
Start the docs server:
bashnpm run docs:devEdit markdown files in
docs/Preview at
http://localhost:5173
Documentation Structure
docs/guide/- User guides and tutorialsdocs/api/- API referencedocs/examples/- Code examplesdocs/.vitepress/config.mjs- Site configuration
Pull Request Guidelines
Before Submitting
- [ ] Code builds without errors
- [ ] All tests pass
- [ ] New features have tests
- [ ] Documentation is updated
- [ ] Commit messages are clear
PR Description
Include:
- What changes were made
- Why the changes were needed
- Any breaking changes
- Related issues
Example:
markdown
## Changes
- Added support for nested scope merging
- Fixed bug in relation merging
## Why
Users reported issues when combining scopes with nested relations
## Breaking Changes
None
## Related Issues
Fixes #123Reporting Issues
Bug Reports
Include:
- TypeORM version
- TypeORM Scopes version
- Node.js version
- Minimal reproduction code
- Expected vs actual behavior
- Error messages
Feature Requests
Include:
- Use case description
- Proposed API
- Example code
- Why existing features don't work
Code of Conduct
- Be respectful and inclusive
- Welcome newcomers
- Focus on constructive feedback
- Help others learn
Questions?
- Open a GitHub Discussion
- Check existing issues
- Read the documentation
License
By contributing, you agree that your contributions will be licensed under the MIT License.
Recognition
Contributors will be:
- Listed in CONTRIBUTORS.md
- Mentioned in release notes
- Credited in documentation
Thank you for contributing! 🎉