# Contribution

Thank you for your interest in contributing to this project! Before you get started, please make sure to review our [Code of conduct](https://retejs.org/docs/code-of-conduct) and [Licensing](https://retejs.org/docs/licensing). By contributing to our project, you agree to comply with the code of conduct and license your contributions in line with our licensing terms.

## Code contribution

The contribution process follows the standard Github method of forking the repository and submitting a pull request.

When submitting a pull request, make sure to reference the relevant issue if applicable. For improvements, provide a detailed explanation of the changes and their rationale. We also recommend discussing the issue in the GitHub issues section prior to submitting the pull request to ascertain whether the problem is common and if the proposed enhancement can be implemented as a standalone package or requires modification of the current codebase.

- Follow the [Style guide](https://retejs.org/docs/development/#style-guide)
- Keep pull requests small and focused on a single issue or topic
- Write simple and meaningful unit tests for new code that you're contributing
- Test changes using Rete QA and, if possible, add E2E tests for new features

When making changes to the code, keep in mind any potential breaking changes and try to use plugins to extend functionality whenever possible instead of modifying the existing code. This approach aligns with the project architecture's goal of minimizing the need for core code changes.

Check out the [Development](https://retejs.org/docs/development) page for a more in-depth guide on developing plugins.

### Step-by-step contribution to the package

Whether you're a newcomer or have experience contributing to the open-source in JS ecosystem, this guide will help you avoid mistakes while saving changes to the version control system and validating them.

#### Prerequisites

- Node.js (recommended v18)
- GIT
- Editor (VS Code, etc.)
- GitHub profile

#### Steps

::diagram{caption="Flow" name="contribution/package"}
::

- Fork the repository
- Clone the fork locally: `git clone <link>`
- Create a branch for your fix or feature (`fix/<name>`, `feature/<name>`, etc.).
- Install dependencies: `npm ci`
- Check if the build works in your environment: `npm run build`
- Make changes
- Run tests, linter, and build
- [Validate changes](https://retejs.org/#package-validate-changes)
- Commit changes according to [conventional commit](https://www.conventionalcommits.org/en/v1.0.0/){rel="nofollow"}
- Push changes to the corresponding branch of this repository
- Create a pull request

#### Validate changes

::diagram{caption="Validation flow" name="contribution/validate-changes"}
::

- Create package tarball: `cd dist && npm pack`
- Check changes in your application

  - Install the received \*.tgz in your application
  - Start the application
- Check changes in template applications

  - Create an application using [Rete Kit](https://retejs.org/docs/development/rete-kit)
  - Install the received \*.tgz in this application
  - Start the application
- E2E testing

  - Specify path to the received \*.tgz in [deps alias file](https://retejs.org/docs/quality-assurance#init)
  - Initialize the test environment using [Rete QA](https://retejs.org/docs/quality-assurance#rete-qa) with `--deps-alias`
  - Run tests: `rete-qa test`

Additionally, if you aim to boost this process during continuous changes using Hot Reload, you have the option to use the [rete-kit build](https://retejs.org/docs/development/rete-kit#build-deps-rete-kit) command. This will ensure that changes in the source code of the cloned package repository are distributed across all specified dependencies and applications.

## Testing and Bug reporting

Testing the project in various environments (browsers, build tools) and reporting bugs is greatly appreciated. [Rete Kit](https://retejs.org/docs/development/rete-kit) tool can assist in testing the project with various frameworks by allowing you to easily create a basic editor for the required version.

If you come across a bug, please report it by creating an issue in the appropriate GitHub repository. If you're not sure where the error comes from, create an issue in the main repository. Your ticket should include detailed steps to reproduce the issue.

Please ensure that there is no previous ticket created with the same problem. If one exists, you can add a comment with a detailed description of the issue from your perspective or add reaction (this is also important).

## Documentation

We welcome any contributions from the community to improve the documentation of our project. If you come across any typos or inaccuracies, please feel free to report them in the [retejs.org](https://github.com/retejs/retejs.org){rel="nofollow"} repository or submit a pull request with your suggested changes.

For those looking to contribute to the documentation, we recommend reviewing the [Contribution Guide](https://github.com/retejs/retejs.org/blob/main/CONTRIBUTION.md){rel="nofollow"} to get started

## Contribute to the community

Experienced with Rete.js? Here are a few ways to contribute to the community:

- engage with users by responding to their questions on GitHub Issues and the Discord server (links available in the header)
- participate in initiatives by reacting (voting) to them or prioritize existing issues under discussion
- Pull Request reviews are appreciated, if you have experience with TypeScript or fluent in the language that the documentation has been updated for

Additionally, you can share information about this framework on your social media. It may help someone who is struggling with a problem or task that this framework can solve.

## Financial support

Donations to the project can be made through a [Patreon subscription](https://patreon.com/ni55an){rel="nofollow"} to support its continued development.

*Thank you for your valuable contribution to the project! If you have any questions or recommendations, please feel free to contact us at <info@retejs.org>*