|
| 1 | +# Contributing to @stainless-code/react-custom-events |
| 2 | + |
| 3 | +Thank you for your interest in contributing to **@stainless-code/react-custom-events**! Your contributions are greatly appreciated, whether it's fixing a bug, adding a feature, improving documentation, or providing feedback. |
| 4 | + |
| 5 | +## Table of Contents |
| 6 | + |
| 7 | +- [Contributing to @stainless-code/react-custom-events](#contributing-to-stainless-codereact-custom-events) |
| 8 | + - [Table of Contents](#table-of-contents) |
| 9 | + - [Getting Started](#getting-started) |
| 10 | + - [Development Workflow](#development-workflow) |
| 11 | + - [Build the project](#build-the-project) |
| 12 | + - [Start development mode](#start-development-mode) |
| 13 | + - [Scripts Overview](#scripts-overview) |
| 14 | + - [Testing](#testing) |
| 15 | + - [Code Style](#code-style) |
| 16 | + - [Submitting a Pull Request](#submitting-a-pull-request) |
| 17 | + - [Thank You!](#thank-you) |
| 18 | + |
| 19 | +--- |
| 20 | + |
| 21 | +## Getting Started |
| 22 | + |
| 23 | +1. Fork the repository on GitHub: |
| 24 | + [https://github.com/stainless-code/react-custom-events](https://github.com/stainless-code/react-custom-events) |
| 25 | + |
| 26 | +2. Clone your fork locally: |
| 27 | + |
| 28 | + ```bash |
| 29 | + git clone https://github.com/<your-username>/react-custom-events.git |
| 30 | + cd react-custom-events |
| 31 | + ``` |
| 32 | + |
| 33 | +3. Install dependencies: |
| 34 | + |
| 35 | + ```bash |
| 36 | + bun install |
| 37 | + ``` |
| 38 | + |
| 39 | + Make sure you have [Bun](https://bun.sh/) installed, or use an alternative package manager (`npm`, `yarn`, or `pnpm`). |
| 40 | + |
| 41 | +--- |
| 42 | + |
| 43 | +## Development Workflow |
| 44 | + |
| 45 | +### Build the project |
| 46 | + |
| 47 | +Run the build process to compile the library: |
| 48 | + |
| 49 | +```bash |
| 50 | +bun run build |
| 51 | +``` |
| 52 | + |
| 53 | +This will generate the compiled output in the `dist` directory. |
| 54 | + |
| 55 | +### Start development mode |
| 56 | + |
| 57 | +To watch for changes and rebuild automatically during development: |
| 58 | + |
| 59 | +```bash |
| 60 | +bun run dev |
| 61 | +``` |
| 62 | + |
| 63 | +--- |
| 64 | + |
| 65 | +## Scripts Overview |
| 66 | + |
| 67 | +The following scripts are available in the `package.json` file: |
| 68 | + |
| 69 | +| Script | Command | Description | |
| 70 | +| -------------- | -------------------------- | ----------------------------------------------- | |
| 71 | +| `build` | `tsup` | Builds the project. | |
| 72 | +| `clean` | `rimraf dist node_modules` | Cleans the output and dependencies. | |
| 73 | +| `dev` | `tsup --watch` | Starts a development build watcher. | |
| 74 | +| `format` | `prettier . --write` | Formats code using Prettier. | |
| 75 | +| `format:check` | `prettier . --check` | Checks code formatting without modifying files. | |
| 76 | +| `lint` | `eslint .` | Lints the project for code quality. | |
| 77 | +| `lint:fix` | `eslint . --fix` | Fixes linting issues automatically. | |
| 78 | +| `test` | `vitest run` | Runs all tests using Vitest. | |
| 79 | +| `typecheck` | `tsc` | Verifies TypeScript type definitions. | |
| 80 | +| `release` | `changeset publish` | Publishes a new release. | |
| 81 | +| `version` | `changeset version` | Prepares a version update with Changesets. | |
| 82 | + |
| 83 | +--- |
| 84 | + |
| 85 | +## Testing |
| 86 | + |
| 87 | +We use [Vitest](https://vitest.dev/) for testing. To run the tests: |
| 88 | + |
| 89 | +```bash |
| 90 | +bun run test |
| 91 | +``` |
| 92 | + |
| 93 | +To run tests in watch mode: |
| 94 | + |
| 95 | +```bash |
| 96 | +bun run test -- --watch |
| 97 | +``` |
| 98 | + |
| 99 | +Please ensure all tests pass before submitting a pull request. |
| 100 | + |
| 101 | +--- |
| 102 | + |
| 103 | +## Code Style |
| 104 | + |
| 105 | +We follow strict coding standards enforced by Prettier and ESLint. |
| 106 | + |
| 107 | +- Run `bun run lint` to check for linting issues. |
| 108 | +- Run `bun run lint:fix` to automatically fix issues. |
| 109 | +- Run `bun run format` to format the codebase. |
| 110 | + |
| 111 | +Before submitting your changes, ensure your code passes linting and formatting checks. |
| 112 | + |
| 113 | +--- |
| 114 | + |
| 115 | +## Submitting a Pull Request |
| 116 | + |
| 117 | +1. Create a feature branch: |
| 118 | + |
| 119 | + ```bash |
| 120 | + git checkout -b my-feature-branch |
| 121 | + ``` |
| 122 | + |
| 123 | +2. Make your changes and commit them: |
| 124 | + |
| 125 | + ```bash |
| 126 | + git add . |
| 127 | + git commit -m "feat: add my feature" |
| 128 | + ``` |
| 129 | + |
| 130 | +3. Push your changes to your fork: |
| 131 | + |
| 132 | + ```bash |
| 133 | + git push origin my-feature-branch |
| 134 | + ``` |
| 135 | + |
| 136 | +4. Open a pull request on GitHub to the `main` branch of the upstream repository: |
| 137 | + [https://github.com/stainless-code/react-custom-events/pulls](https://github.com/stainless-code/react-custom-events/pulls) |
| 138 | + |
| 139 | +--- |
| 140 | + |
| 141 | +## Thank You! |
| 142 | + |
| 143 | +Your contributions are valued and appreciated! If you encounter any issues or need guidance, feel free to open an issue or contact us at [[email protected]](mailto:[email protected]). |
0 commit comments