You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
5.9 KiB
5.9 KiB
Contributing to World Component
Thank you for your interest in contributing to the World Component project! This document provides guidelines and information for contributors.
Table of Contents
- Getting Started
- Development Setup
- Coding Standards
- Architecture Guidelines
- Testing
- Pull Request Process
- Code Review Guidelines
Getting Started
Prerequisites
- Node.js >= 16.0.0
- npm >= 8.0.0
- Git
Development Setup
-
Fork the repository
git clone https://github.com/yourusername/world-component.git cd world-component
-
Install dependencies
npm install
-
Start development server
npm run dev
-
Run type checking
npm run type-check
Coding Standards
TypeScript Guidelines
- Use strict TypeScript configuration
- Provide comprehensive type definitions
- Use interfaces for object shapes
- Prefer
const
overlet
when possible - Use meaningful variable and function names
Vue Component Guidelines
- Use Vue 3 Composition API or Class-based components with vue-facing-decorator
- Keep components focused and single-purpose
- Use proper prop validation
- Implement proper lifecycle management
- Use scoped styles when possible
Three.js Guidelines
- Follow Three.js best practices for performance
- Dispose of resources properly (geometries, materials, textures)
- Use object pooling for frequently created/destroyed objects
- Implement proper cleanup in component unmount
Documentation Standards
- Document all public methods and classes
- Include JSDoc comments for complex functions
- Provide usage examples in documentation
- Update README.md for significant changes
Code Style
- Follow PEP 8 equivalent for TypeScript (80 character line limit)
- Use meaningful variable names
- Add comments for complex logic
- Keep methods under 80 lines when possible
- Use consistent indentation (2 spaces)
Architecture Guidelines
System Design
- Keep systems modular and focused
- Use dependency injection where appropriate
- Implement proper error handling
- Follow the single responsibility principle
File Organization
src/
├── systems/ # Core rendering systems
│ ├── Controls.ts # Camera controls
│ ├── Loop.ts # Animation loop
│ ├── Renderer.ts # WebGL renderer
│ └── Resizer.ts # Responsive resizing
├── components/
│ └── objects/ # 3D objects
├── types/ # TypeScript definitions
└── utils/ # Utility functions
Adding New Systems
- Create a new TypeScript file in
src/systems/
- Export a class with clear interfaces
- Add comprehensive documentation
- Include proper error handling
- Add to the main WorldComponent integration
Adding New Objects
- Create a new TypeScript file in
src/components/objects/
- Extend or use Three.js objects appropriately
- Implement a
tick()
method if animation is needed - Add proper cleanup methods
- Document the object's purpose and usage
Testing
Running Tests
# Run all tests
npm test
# Run tests in watch mode
npm run test:watch
# Run tests with coverage
npm run test:coverage
Writing Tests
- Write unit tests for all public methods
- Test error conditions and edge cases
- Use descriptive test names
- Mock external dependencies
- Test Three.js objects in isolation
Pull Request Process
Before Submitting
-
Ensure code quality
- Run
npm run type-check
- Run
npm run lint
- Run
npm run format
- All tests pass
- Run
-
Update documentation
- Update README.md if needed
- Add JSDoc comments for new methods
- Update any relevant documentation
-
Test thoroughly
- Test in different browsers
- Test with different screen sizes
- Test performance impact
Pull Request Guidelines
-
Create a descriptive title
- Use conventional commit format
- Be specific about the change
-
Write a detailed description
- Explain what the PR does
- Include screenshots for UI changes
- Reference related issues
-
Keep PRs focused
- One feature or fix per PR
- Keep changes manageable
- Break large changes into smaller PRs
Code Review Guidelines
Review Process
-
Automated checks must pass
- TypeScript compilation
- Linting
- Tests
-
Manual review checklist
- Code follows project standards
- Documentation is complete
- Error handling is appropriate
- Performance impact is considered
- Security implications are addressed
Review Comments
- Be constructive and specific
- Suggest improvements when possible
- Ask questions for clarification
- Use inline comments for specific issues
Security Considerations
Code Review Checklist
- No hardcoded secrets or API keys
- Input validation is implemented
- Error messages don't expose sensitive information
- External dependencies are from trusted sources
- Three.js objects are properly disposed
- No XSS vulnerabilities in dynamic content
Reporting Security Issues
If you discover a security vulnerability, please:
- Do not create a public issue
- Email the maintainer directly
- Provide detailed information
- Allow time for response
Getting Help
- Documentation: Check the README.md and inline documentation
- Issues: Search existing issues before creating new ones
- Discussions: Use GitHub Discussions for questions
- Chat: Join our community chat (if available)
License
By contributing to this project, you agree that your contributions will be licensed under the same license as the project.
Thank you for contributing to World Component! Your efforts help make this project better for everyone.