|
| 1 | +# Contributing to react-resize-detector-context |
| 2 | + |
| 3 | +First off, thank you for considering contributing to react-resize-detector-context! 🎉 |
| 4 | + |
| 5 | +The following is a set of guidelines for contributing to this project. These are mostly guidelines, not rules. Use your best judgment, and feel free to propose changes to this document in a pull request. |
| 6 | + |
| 7 | +## Code of Conduct |
| 8 | + |
| 9 | +This project and everyone participating in it is governed by our Code of Conduct. By participating, you are expected to uphold this code. |
| 10 | + |
| 11 | +## How Can I Contribute? |
| 12 | + |
| 13 | +### Reporting Bugs |
| 14 | + |
| 15 | +Before creating bug reports, please check the existing issues as you might find out that you don't need to create one. When you are creating a bug report, please include as many details as possible using our bug report template. |
| 16 | + |
| 17 | +**Great Bug Reports** tend to have: |
| 18 | +- A quick summary and/or background |
| 19 | +- Steps to reproduce |
| 20 | +- What you expected would happen |
| 21 | +- What actually happens |
| 22 | +- Notes (possibly including why you think this might be happening, or stuff you tried that didn't work) |
| 23 | + |
| 24 | +### Suggesting Enhancements |
| 25 | + |
| 26 | +Enhancement suggestions are tracked as GitHub issues. When creating an enhancement suggestion, please use our feature request template and include: |
| 27 | +- A clear and descriptive title |
| 28 | +- A detailed description of the proposed feature |
| 29 | +- Examples of how the feature would be used |
| 30 | +- Why this enhancement would be useful |
| 31 | + |
| 32 | +### Pull Requests |
| 33 | + |
| 34 | +1. Fork the repo and create your branch from `main`. |
| 35 | +2. If you've added code that should be tested, add tests. |
| 36 | +3. If you've changed APIs, update the documentation. |
| 37 | +4. Ensure the test suite passes. |
| 38 | +5. Make sure your code lints. |
| 39 | +6. Issue that pull request! |
| 40 | + |
| 41 | +## Development Setup |
| 42 | + |
| 43 | +1. Fork and clone the repository |
| 44 | +```bash |
| 45 | +git clone https://github.com/your-username/react-resize-detector-context.git |
| 46 | +cd react-resize-detector-context |
| 47 | +``` |
| 48 | + |
| 49 | +2. Install dependencies |
| 50 | +```bash |
| 51 | +pnpm install |
| 52 | +``` |
| 53 | + |
| 54 | +3. Run development mode |
| 55 | +```bash |
| 56 | +pnpm dev |
| 57 | +``` |
| 58 | + |
| 59 | +This will start: |
| 60 | +- Build watch mode |
| 61 | +- Storybook on http://localhost:6006 |
| 62 | +- Test watch mode |
| 63 | + |
| 64 | +## Development Workflow |
| 65 | + |
| 66 | +### Running Tests |
| 67 | +```bash |
| 68 | +pnpm test # Run tests in watch mode |
| 69 | +pnpm test:ci # Run tests once with coverage |
| 70 | +``` |
| 71 | + |
| 72 | +### Linting and Formatting |
| 73 | +```bash |
| 74 | +pnpm lint # Run ESLint and fix issues |
| 75 | +pnpm format # Format code with Prettier |
| 76 | +``` |
| 77 | + |
| 78 | +### Building |
| 79 | +```bash |
| 80 | +pnpm build # Build the package |
| 81 | +``` |
| 82 | + |
| 83 | +### Storybook |
| 84 | +```bash |
| 85 | +pnpm storybook # Run Storybook locally |
| 86 | +``` |
| 87 | + |
| 88 | +## Coding Guidelines |
| 89 | + |
| 90 | +### TypeScript |
| 91 | +- Use TypeScript for all new code |
| 92 | +- Ensure proper typing (avoid `any` when possible) |
| 93 | +- Follow the existing code style |
| 94 | + |
| 95 | +### React |
| 96 | +- Use functional components with hooks |
| 97 | +- Follow React best practices |
| 98 | +- Keep components focused and composable |
| 99 | + |
| 100 | +### Testing |
| 101 | +- Write tests for new features |
| 102 | +- Ensure existing tests pass |
| 103 | +- Aim for high test coverage |
| 104 | + |
| 105 | +### Comments and Documentation |
| 106 | +- Use JSDoc comments for public APIs |
| 107 | +- Keep the README updated |
| 108 | +- Document breaking changes |
| 109 | + |
| 110 | +## Commit Messages |
| 111 | + |
| 112 | +We use conventional commits. Please follow this format: |
| 113 | + |
| 114 | +``` |
| 115 | +<type>(<scope>): <subject> |
| 116 | +
|
| 117 | +<body> |
| 118 | +
|
| 119 | +<footer> |
| 120 | +``` |
| 121 | + |
| 122 | +Types: |
| 123 | +- `feat`: A new feature |
| 124 | +- `fix`: A bug fix |
| 125 | +- `docs`: Documentation only changes |
| 126 | +- `style`: Changes that don't affect code meaning |
| 127 | +- `refactor`: Code change that neither fixes a bug nor adds a feature |
| 128 | +- `perf`: Performance improvement |
| 129 | +- `test`: Adding missing tests |
| 130 | +- `chore`: Changes to build process or auxiliary tools |
| 131 | + |
| 132 | +Example: |
| 133 | +``` |
| 134 | +feat(provider): add devMode prop for console logging control |
| 135 | +
|
| 136 | +Added optional devMode prop to BreakpointProvider to control when |
| 137 | +console errors are displayed. Defaults to NODE_ENV !== 'production'. |
| 138 | +``` |
| 139 | + |
| 140 | +## Release Process |
| 141 | + |
| 142 | +Releases are managed by maintainers using: |
| 143 | +```bash |
| 144 | +pnpm release |
| 145 | +``` |
| 146 | + |
| 147 | +This will: |
| 148 | +1. Build the package |
| 149 | +2. Update version |
| 150 | +3. Create git tag |
| 151 | +4. Push to GitHub |
| 152 | +5. Create GitHub release |
| 153 | +6. Publish to npm (if configured) |
| 154 | + |
| 155 | +## Questions? |
| 156 | + |
| 157 | +Feel free to open an issue with your question or reach out to the maintainers. |
| 158 | + |
| 159 | +Thank you for contributing! 🚀✨ |
0 commit comments