|
| 1 | +# Contributing to @react-oauth |
| 2 | + |
| 3 | +Thank you for your interest in contributing to @react-oauth! 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/yourusername/react-oauth.git` |
| 9 | +3. Install dependencies: `yarn install` |
| 10 | +4. Create a branch: `git checkout -b feature/your-feature-name` |
| 11 | + |
| 12 | +## Development Workflow |
| 13 | + |
| 14 | +### Building |
| 15 | + |
| 16 | +```bash |
| 17 | +# Build all packages |
| 18 | +yarn build |
| 19 | + |
| 20 | +# Start development mode for all packages |
| 21 | +yarn dev |
| 22 | + |
| 23 | +# Start development mode for Google package only |
| 24 | +yarn dev:google |
| 25 | +``` |
| 26 | + |
| 27 | +### Linting & Formatting |
| 28 | + |
| 29 | +We use Prettier for code formatting. Code is automatically formatted on commit via lint-staged. |
| 30 | + |
| 31 | +```bash |
| 32 | +# Check code formatting |
| 33 | +yarn prettier:check |
| 34 | + |
| 35 | +# Auto-fix formatting issues |
| 36 | +yarn prettier:fix |
| 37 | +``` |
| 38 | + |
| 39 | +### Committing Changes |
| 40 | + |
| 41 | +We use [Commitizen](https://github.com/commitizen/cz-cli) for creating properly formatted commit messages following [Conventional Commits](https://www.conventionalcommits.org/): |
| 42 | + |
| 43 | +```bash |
| 44 | +yarn commit |
| 45 | +``` |
| 46 | + |
| 47 | +This will guide you through creating a commit message interactively. |
| 48 | + |
| 49 | +## Code Style |
| 50 | + |
| 51 | +- We use TypeScript with strict mode enabled |
| 52 | +- We use Prettier for code formatting (runs automatically on commit) |
| 53 | +- Follow the existing code style in the repository |
| 54 | +- Write meaningful commit messages using Conventional Commits |
| 55 | +- Run `yarn prettier:fix` before committing to ensure formatting |
| 56 | + |
| 57 | +## Adding a New OAuth Provider |
| 58 | + |
| 59 | +1. Create a new package directory under `packages/@react-oauth/` |
| 60 | +2. Follow the structure of `packages/@react-oauth/github/` |
| 61 | +3. Implement the OAuth flow for your provider |
| 62 | +4. Update the root README.md |
| 63 | +5. Create a changeset: `yarn changeset` |
| 64 | + |
| 65 | +## Pull Request Process |
| 66 | + |
| 67 | +1. Run `yarn build` to ensure everything builds successfully |
| 68 | +2. Run `yarn prettier:check` to ensure formatting is correct |
| 69 | +3. Update documentation if needed |
| 70 | +4. Create a changeset if this is a user-facing change: `yarn changeset` |
| 71 | +5. Submit your pull request with a clear description |
| 72 | + |
| 73 | +## Commit Messages |
| 74 | + |
| 75 | +We follow the [Conventional Commits](https://www.conventionalcommits.org/) specification. Use `yarn commit` for interactive commit creation. |
| 76 | + |
| 77 | +**Format:** |
| 78 | + |
| 79 | +``` |
| 80 | +<type>(<scope>): <subject> |
| 81 | +``` |
| 82 | + |
| 83 | +**Types:** |
| 84 | + |
| 85 | +- `feat:` A new feature |
| 86 | +- `fix:` A bug fix |
| 87 | +- `docs:` Documentation only changes |
| 88 | +- `style:` Code style changes (formatting, etc.) |
| 89 | +- `refactor:` Code refactoring |
| 90 | +- `test:` Adding or updating tests |
| 91 | +- `chore:` Maintenance tasks |
| 92 | + |
| 93 | +**Scopes:** |
| 94 | + |
| 95 | +- `google` - `@react-oauth/google` package |
| 96 | +- `github` - `@react-oauth/github` package |
| 97 | +- `playground` - Playground app |
| 98 | +- `repo` - Repository config/tooling |
| 99 | + |
| 100 | +**Examples:** |
| 101 | + |
| 102 | +``` |
| 103 | +feat(google): add custom button themes |
| 104 | +fix(github): handle popup blocked error |
| 105 | +docs(repo): update contributing guide |
| 106 | +``` |
| 107 | + |
| 108 | +## Versioning |
| 109 | + |
| 110 | +This project uses [Changesets](https://github.com/changesets/changesets) for version management. If your PR includes user-facing changes: |
| 111 | + |
| 112 | +1. Create a changeset: `yarn changeset` |
| 113 | +2. Select the affected packages |
| 114 | +3. Choose the type of change (major, minor, patch) |
| 115 | +4. Write a summary of the changes |
| 116 | +5. Commit the changeset file with your changes |
| 117 | + |
| 118 | +## Questions? |
| 119 | + |
| 120 | +Feel free to open an issue for any questions or concerns. |
0 commit comments