|
| 1 | +# Contributing to React Telegram |
| 2 | + |
| 3 | +Thank you for your interest in contributing to React Telegram! This document provides guidelines and instructions for contributing. |
| 4 | + |
| 5 | +## Development Setup |
| 6 | + |
| 7 | +1. Fork and clone the repository |
| 8 | +2. Install dependencies: |
| 9 | + ```bash |
| 10 | + bun install |
| 11 | + ``` |
| 12 | +3. Run tests: |
| 13 | + ```bash |
| 14 | + bun test |
| 15 | + ``` |
| 16 | + |
| 17 | +## Project Structure |
| 18 | + |
| 19 | +This is a monorepo managed with Bun workspaces: |
| 20 | + |
| 21 | +- `packages/core` - Core React reconciler |
| 22 | +- `packages/mtcute-adapter` - MTCute Telegram adapter |
| 23 | +- `packages/examples` - Example implementations |
| 24 | + |
| 25 | +## Making Changes |
| 26 | + |
| 27 | +### 1. Create a Feature Branch |
| 28 | + |
| 29 | +```bash |
| 30 | +git checkout -b feature/your-feature-name |
| 31 | +``` |
| 32 | + |
| 33 | +### 2. Make Your Changes |
| 34 | + |
| 35 | +- Write clear, concise commit messages |
| 36 | +- Add tests for new functionality |
| 37 | +- Update documentation as needed |
| 38 | +- Ensure all tests pass |
| 39 | + |
| 40 | +### 3. Create a Changeset |
| 41 | + |
| 42 | +Before submitting a PR, create a changeset describing your changes: |
| 43 | + |
| 44 | +```bash |
| 45 | +bun run changeset |
| 46 | +``` |
| 47 | + |
| 48 | +This will prompt you to: |
| 49 | +- Select which packages changed |
| 50 | +- Choose the type of change (major/minor/patch) |
| 51 | +- Write a summary of changes |
| 52 | + |
| 53 | +### 4. Submit a Pull Request |
| 54 | + |
| 55 | +- Push your branch to your fork |
| 56 | +- Open a PR against the `main` branch |
| 57 | +- Fill out the PR template |
| 58 | +- Wait for CI checks to pass |
| 59 | + |
| 60 | +## Code Style |
| 61 | + |
| 62 | +We use Prettier for code formatting: |
| 63 | + |
| 64 | +```bash |
| 65 | +bun run format |
| 66 | +``` |
| 67 | + |
| 68 | +## Testing |
| 69 | + |
| 70 | +### Running Tests |
| 71 | + |
| 72 | +```bash |
| 73 | +# Run all tests |
| 74 | +bun test |
| 75 | + |
| 76 | +# Run tests in watch mode |
| 77 | +bun test:watch |
| 78 | + |
| 79 | +# Run tests for a specific package |
| 80 | +cd packages/core && bun test |
| 81 | +``` |
| 82 | + |
| 83 | +### Writing Tests |
| 84 | + |
| 85 | +- Place test files next to the code they test |
| 86 | +- Use `.test.ts` or `.test.tsx` extension |
| 87 | +- Follow existing test patterns |
| 88 | + |
| 89 | +## Type Checking |
| 90 | + |
| 91 | +Ensure your code passes TypeScript checks: |
| 92 | + |
| 93 | +```bash |
| 94 | +bun run type-check |
| 95 | +``` |
| 96 | + |
| 97 | +## CI/CD Pipeline |
| 98 | + |
| 99 | +Our GitHub Actions workflows run: |
| 100 | +- Tests on multiple Node versions |
| 101 | +- Type checking |
| 102 | +- Build verification |
| 103 | +- Security audits |
| 104 | + |
| 105 | +## Release Process |
| 106 | + |
| 107 | +Releases are automated through GitHub Actions: |
| 108 | + |
| 109 | +1. Merge changesets to main |
| 110 | +2. Automated PR is created for version bumps |
| 111 | +3. Merge the version PR |
| 112 | +4. Packages are automatically published to npm |
| 113 | + |
| 114 | +## Questions? |
| 115 | + |
| 116 | +Feel free to: |
| 117 | +- Open an issue for bugs or feature requests |
| 118 | +- Start a discussion for questions |
| 119 | +- Join our community chat (if available) |
| 120 | + |
| 121 | +## License |
| 122 | + |
| 123 | +By contributing, you agree that your contributions will be licensed under the project's MIT License. |
0 commit comments