From 0c534e53801d9c785f1b8b41405eedc39eebd56b Mon Sep 17 00:00:00 2001 From: SutuSebastian Date: Fri, 22 Nov 2024 19:13:43 +0200 Subject: [PATCH] chore: add `CONTRIBUTING.md` and update `README.md` --- CONTRIBUTING.md | 143 ++++++++++++++++++++++++++++++++++++++++++++++++ README.md | 4 +- 2 files changed, 146 insertions(+), 1 deletion(-) create mode 100644 CONTRIBUTING.md diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..b55cbfc --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,143 @@ +# Contributing to @stainless-code/react-custom-events + +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. + +## Table of Contents + +- [Contributing to @stainless-code/react-custom-events](#contributing-to-stainless-codereact-custom-events) + - [Table of Contents](#table-of-contents) + - [Getting Started](#getting-started) + - [Development Workflow](#development-workflow) + - [Build the project](#build-the-project) + - [Start development mode](#start-development-mode) + - [Scripts Overview](#scripts-overview) + - [Testing](#testing) + - [Code Style](#code-style) + - [Submitting a Pull Request](#submitting-a-pull-request) + - [Thank You!](#thank-you) + +--- + +## Getting Started + +1. Fork the repository on GitHub: + [https://github.com/stainless-code/react-custom-events](https://github.com/stainless-code/react-custom-events) + +2. Clone your fork locally: + + ```bash + git clone https://github.com//react-custom-events.git + cd react-custom-events + ``` + +3. Install dependencies: + + ```bash + bun install + ``` + + Make sure you have [Bun](https://bun.sh/) installed, or use an alternative package manager (`npm`, `yarn`, or `pnpm`). + +--- + +## Development Workflow + +### Build the project + +Run the build process to compile the library: + +```bash +bun run build +``` + +This will generate the compiled output in the `dist` directory. + +### Start development mode + +To watch for changes and rebuild automatically during development: + +```bash +bun run dev +``` + +--- + +## Scripts Overview + +The following scripts are available in the `package.json` file: + +| Script | Command | Description | +| -------------- | -------------------------- | ----------------------------------------------- | +| `build` | `tsup` | Builds the project. | +| `clean` | `rimraf dist node_modules` | Cleans the output and dependencies. | +| `dev` | `tsup --watch` | Starts a development build watcher. | +| `format` | `prettier . --write` | Formats code using Prettier. | +| `format:check` | `prettier . --check` | Checks code formatting without modifying files. | +| `lint` | `eslint .` | Lints the project for code quality. | +| `lint:fix` | `eslint . --fix` | Fixes linting issues automatically. | +| `test` | `vitest run` | Runs all tests using Vitest. | +| `typecheck` | `tsc` | Verifies TypeScript type definitions. | +| `release` | `changeset publish` | Publishes a new release. | +| `version` | `changeset version` | Prepares a version update with Changesets. | + +--- + +## Testing + +We use [Vitest](https://vitest.dev/) for testing. To run the tests: + +```bash +bun run test +``` + +To run tests in watch mode: + +```bash +bun run test -- --watch +``` + +Please ensure all tests pass before submitting a pull request. + +--- + +## Code Style + +We follow strict coding standards enforced by Prettier and ESLint. + +- Run `bun run lint` to check for linting issues. +- Run `bun run lint:fix` to automatically fix issues. +- Run `bun run format` to format the codebase. + +Before submitting your changes, ensure your code passes linting and formatting checks. + +--- + +## Submitting a Pull Request + +1. Create a feature branch: + + ```bash + git checkout -b my-feature-branch + ``` + +2. Make your changes and commit them: + + ```bash + git add . + git commit -m "feat: add my feature" + ``` + +3. Push your changes to your fork: + + ```bash + git push origin my-feature-branch + ``` + +4. Open a pull request on GitHub to the `main` branch of the upstream repository: + [https://github.com/stainless-code/react-custom-events/pulls](https://github.com/stainless-code/react-custom-events/pulls) + +--- + +## Thank You! + +Your contributions are valued and appreciated! If you encounter any issues or need guidance, feel free to open an issue or contact us at [sebastian.sutu@stainless-code.com](mailto:sebastian.sutu@stainless-code.com). diff --git a/README.md b/README.md index 6006c22..03cc3c1 100644 --- a/README.md +++ b/README.md @@ -143,7 +143,9 @@ Custom hook to listen for a custom event and handle the payload. ## Contributing -Feel free to submit issues or PRs to improve the library! +Feel free to submit issues or pull requests to improve the library. Every bit of help is appreciated. 💖 + +[Read the contribution guidelines](./CONTRIBUTING.md). ## License