|
| 1 | +# :recycle: Contributing |
| 2 | + |
| 3 | +We welcome code changes that improve this library or fix a problem, please make sure to follow all best practices and add tests if applicable before submitting a Pull Request on Github. We are very happy to merge your code in the official repository. Make sure to sign our [Contributor License Agreement (CLA)](https://docs.google.com/forms/d/e/1FAIpQLScFKsKkAJI7mhCr7K9rEIOpqIDThrWxuvxnwUq2XkHyG154vQ/viewform) first. See our license file for more details. |
| 4 | + |
| 5 | +## Getting started |
| 6 | + |
| 7 | +### Install dependencies |
| 8 | + |
| 9 | +```shell |
| 10 | +$ yarn install |
| 11 | +``` |
| 12 | + |
| 13 | +### Run tests |
| 14 | + |
| 15 | +```shell |
| 16 | +$ yarn test |
| 17 | +``` |
| 18 | + |
| 19 | +## Linting and code formatting |
| 20 | + |
| 21 | +We use [ESLint](https://eslint.org/) for linting and [Prettier](https://prettier.io/) for code formatting. We enforce formatting with pre-commit hook, linting with CI. If your IDE has integration with these tools, it's recommended to set them up. |
| 22 | + |
| 23 | +## Commit message convention |
| 24 | + |
| 25 | +Since we're autogenerating our [CHANGELOG](./CHANGELOG.md), we need to follow a specific commit message convention. |
| 26 | +You can read about conventional commits [here](https://www.conventionalcommits.org/). Here's how a usual commit message looks like for a new feature: `feat: allow provided config object to extend other configs`. A bugfix: `fix: prevent racing of requests`. |
| 27 | + |
| 28 | +## Generating code from Open API |
| 29 | + |
| 30 | +Checkout the [protocol](https://github.com/GetStream/protocol) or [chat](https://github.com/GetStream/chat) reporisitories and run one of the following commands: |
| 31 | + |
| 32 | +```shell |
| 33 | +# if you have protocol repo: |
| 34 | +$ yarn generate:open-api |
| 35 | +# if you have chat repo |
| 36 | +$ yarn generate:open-api:dev |
| 37 | +``` |
| 38 | + |
| 39 | +Fix manually the known issues issues in the generated code: |
| 40 | + |
| 41 | +- Add `// @ts-expect-error` for imports for `ImageSizeRequest`, `OnlyUserIDRequest` in the `gen/chat/FilesApi.ts` and `gen/chat/MessagesApi.ts` files |
| 42 | +- Add `// @ts-expect-error` for duplicate exports in `gen/chat/index.ts` |
| 43 | +- Fix the query param serizalization in the `gen/chat/MessagesApi.ts` file's `getManyMessagesRaw` function. This is the correct serialization: |
| 44 | + |
| 45 | +```typescript |
| 46 | +if (requestParameters.ids) { |
| 47 | + queryParameters["ids"] = requestParameters.ids.join(","); |
| 48 | +} |
| 49 | +``` |
| 50 | + |
| 51 | +To check your work, run the following commands: |
| 52 | + |
| 53 | +``` |
| 54 | +yarn start |
| 55 | +yarn test |
| 56 | +``` |
| 57 | + |
| 58 | +If these commands run fine, we're good to go. |
| 59 | + |
| 60 | +## Release (for Stream developers) |
| 61 | + |
| 62 | +Releasing this package involves two GitHub Action steps: |
| 63 | + |
| 64 | +- Whenever a new feature/fix is pushed to `main` a release PR is created ([example PR](https://github.com/GetStream/stream-node/pull/8)). That PR will be automatically updated on pushes to `main`. |
| 65 | +- When you're ready to release, merge the release PR |
| 66 | + |
| 67 | +Once the PR is merged, it automatically kicks off another job which will release the pacakge to npm. |
0 commit comments