|
| 1 | +# Contributing to Object UI |
| 2 | + |
| 3 | +Thank you for your interest in contributing to Object UI! This document provides guidelines and instructions for contributing. |
| 4 | + |
| 5 | +## Getting Started |
| 6 | + |
| 7 | +1. Fork the repository |
| 8 | +2. Clone your fork: `git clone https://github.com/YOUR_USERNAME/object-ui.git` |
| 9 | +3. Install dependencies: `pnpm install` |
| 10 | +4. Create a new branch: `git checkout -b feature/your-feature-name` |
| 11 | + |
| 12 | +## Development Workflow |
| 13 | + |
| 14 | +### Running Tests |
| 15 | + |
| 16 | +```bash |
| 17 | +# Run all tests |
| 18 | +pnpm test |
| 19 | + |
| 20 | +# Run tests in watch mode |
| 21 | +pnpm test:watch |
| 22 | + |
| 23 | +# Run tests with UI |
| 24 | +pnpm test:ui |
| 25 | + |
| 26 | +# Generate coverage report |
| 27 | +pnpm test:coverage |
| 28 | +``` |
| 29 | + |
| 30 | +### Building |
| 31 | + |
| 32 | +```bash |
| 33 | +# Build all packages |
| 34 | +pnpm build |
| 35 | + |
| 36 | +# Build specific package |
| 37 | +cd packages/protocol && pnpm build |
| 38 | +``` |
| 39 | + |
| 40 | +### Linting |
| 41 | + |
| 42 | +```bash |
| 43 | +# Lint all packages |
| 44 | +pnpm lint |
| 45 | +``` |
| 46 | + |
| 47 | +## Writing Tests |
| 48 | + |
| 49 | +All tests should be placed in `__tests__` directories within the source code. We use **Vitest** and **React Testing Library**. |
| 50 | + |
| 51 | +Example test structure: |
| 52 | + |
| 53 | +```typescript |
| 54 | +import { describe, it, expect } from 'vitest'; |
| 55 | +import { render, screen } from '@testing-library/react'; |
| 56 | + |
| 57 | +describe('ComponentName', () => { |
| 58 | + it('should render correctly', () => { |
| 59 | + render(<ComponentName />); |
| 60 | + expect(screen.getByText('Expected Text')).toBeInTheDocument(); |
| 61 | + }); |
| 62 | +}); |
| 63 | +``` |
| 64 | + |
| 65 | +## Commit Guidelines |
| 66 | + |
| 67 | +We follow conventional commit messages: |
| 68 | + |
| 69 | +- `feat:` - New features |
| 70 | +- `fix:` - Bug fixes |
| 71 | +- `docs:` - Documentation changes |
| 72 | +- `test:` - Adding or updating tests |
| 73 | +- `chore:` - Maintenance tasks |
| 74 | +- `refactor:` - Code refactoring |
| 75 | + |
| 76 | +Example: `feat: add new button variant` |
| 77 | + |
| 78 | +## Pull Request Process |
| 79 | + |
| 80 | +1. Ensure all tests pass: `pnpm test` |
| 81 | +2. Ensure the build succeeds: `pnpm build` |
| 82 | +3. Update documentation if needed |
| 83 | +4. Create a pull request with a clear description of changes |
| 84 | +5. Link any relevant issues |
| 85 | + |
| 86 | +## Code Style |
| 87 | + |
| 88 | +- Follow existing code style in the project |
| 89 | +- Use TypeScript for type safety |
| 90 | +- Write meaningful variable and function names |
| 91 | +- Add comments for complex logic |
| 92 | +- Keep functions small and focused |
| 93 | + |
| 94 | +## Adding New Packages |
| 95 | + |
| 96 | +If you need to add a new package to the monorepo: |
| 97 | + |
| 98 | +1. Create a new directory under `packages/` |
| 99 | +2. Add a `package.json` with proper workspace dependencies |
| 100 | +3. Update the main README if the package is user-facing |
| 101 | +4. Add tests for the new package |
| 102 | + |
| 103 | +## Questions? |
| 104 | + |
| 105 | +If you have questions, feel free to: |
| 106 | +- Open an issue with the `question` label |
| 107 | +- Start a discussion in GitHub Discussions |
| 108 | +- Reach out to the maintainers |
| 109 | + |
| 110 | +## License |
| 111 | + |
| 112 | +By contributing, you agree that your contributions will be licensed under the MIT License. |
0 commit comments