Thank you for your interest in contributing to the Dice Roller TypeScript library! This document provides guidelines for contributing to the project.
- Fork the repository
- Clone your fork locally
- Install dependencies:
npm install - Create a feature branch:
git checkout -b feature/your-feature-name
- Node.js 16+
- npm or yarn
- TypeScript knowledge
git clone https://github.com/your-username/roller.git
cd roller
npm installnpm test # Run all tests
npm run test:watch # Run tests in watch mode
npm run test:coverage # Run tests with coverage reportnpm run build # Compile TypeScript
npm run lint # Run ESLint
npm run format # Format code with Prettier- Use TypeScript strict mode
- Provide explicit type annotations for public APIs
- Avoid
anytypes - use proper typing - Follow ES6+ conventions where appropriate
- Use Prettier for formatting (configured in
.prettierrc) - Follow ESLint rules (configured in
.eslintrc.js) - Use meaningful variable and function names
- Keep functions focused and single-purpose
- Maintain compatibility with the original C# implementation
- Preserve existing method signatures and behavior
- Document any breaking changes in pull requests
- Target 100% test coverage
- Test all public methods and edge cases
- Include error condition testing
- Use Jest for all testing
describe('ClassName', () => {
describe('methodName', () => {
it('should handle normal case', () => {
// Test implementation
});
it('should handle edge case', () => {
// Test implementation
});
it('should throw error for invalid input', () => {
// Error testing
});
});
});-
Create an Issue: For significant changes, create an issue first to discuss
-
Branch Naming: Use descriptive names like
feature/add-custom-diceorfix/parser-bug -
Commit Messages: Use conventional commits format:
feat: add new dice expression parserfix: resolve random number generation issuedocs: update API documentationtest: add edge case tests for Die class
-
Pull Request Requirements:
- Include description of changes
- Reference related issues
- Ensure all tests pass
- Maintain or improve test coverage
- Update documentation if needed
-
Code Review: Address feedback promptly and professionally
When contributing, understand these key components:
- Roller: Main dice rolling engine with advanced mechanics
- Die: Individual die representation with customizable random functions
- DiceExpression: Parses and evaluates complex dice expressions
- DiceExpressionPart: Components of dice expressions
- Update JSDoc comments for new/modified public methods
- Include usage examples for significant features
- Update README.md if adding new functionality
- Maintain API documentation accuracy
When reporting bugs:
- Use the issue template
- Provide minimal reproduction case
- Include environment details (Node.js version, OS)
- Specify expected vs actual behavior
For new features:
- Check existing issues first
- Describe the use case clearly
- Consider backward compatibility
- Propose API design if applicable
- Open an issue with the "question" label
- Check existing documentation first
- Be specific about what you're trying to achieve
By contributing, you agree that your contributions will be licensed under the same license