# How to Contribute
The following is a set of guidelines for contributing to Galacean. Please spend several minutes reading the article before you create an issue or pull request.
## Code of Conductor
We have adopted the [Contributor Covenant](https://www.contributor-covenant.org/) as its Code of Conduct, and we expect project participants to adhere to it. Please read [the full text](./CODE_OF_CONDUCTOR.md) so that you can understand what actions will and will not be tolerated.
## Issue Reporting
You can make use of the Github Issues for Galacean to:
1. Report a bug.
1. Request a feature
1. Ask a question
Before reporting an issue, please take the following steps:
1. Search the existing issues.
1. Clearly describe the issue including steps to reproduce when it is a bug.
1. Provide an online example. Make use of [jsFiddle](http://jsfiddle.net/), [jsBin](http://jsbin.com/).
If you open an issue that does not conform to the requirements, **it will be closed immediately**.
## Contributing Code
### Setting Up
To set up for contributing code, you will take a few steps:
1. Ensure you have node.js installed. You can download Node.js from [nodejs.org](https://nodejs.org/en/) and make sure your Node.js is later than `12`. Use `node -v` to check your Node.js version.
1. Fork the Galacean repository.
1. Run `npm run bootstrap` in your cloned folder to install all the dependencies for Galacean.
### Making a Change
After setting up the environment of Galacean, you can make your change already. The only thing you should make sure is that you checked out the correct branch.
### Test Your Change
You can test your change by the following ways:
- Clone the Galacean playground repository and write a demo for your change.
- Write an uint test in the Galacean repository and run `npm run test` to execute the uint test.
- [Write an e2e test](https://github.com/galacean/runtime/wiki/How-to-write-an-e2e-Test-for-runtime) in the Galacean repository and run `npm run e2e` to execute the e2e test.
### Submitting a Pull Request
After you have made and tested your change, commit and push it to your fork. Then, open a Pull Request from your fork to the main Galacean repository on the branch you used in the `Making a Change` section of this document.
### Reviewing a Pull Request
#### Addressing review feedback
If we ask for changes via code reviews then:
1. Make the required updates to the code.
1. Re-run the Angular test suites to ensure tests are still passing.
1. Create a fixup commit and push to your GitHub repository (this will update your Pull Request):
```
git commit --all --fixup HEAD
git push
```
That's it! Thank you for your contribution!
##### Updating the commit message
A reviewer might often suggest changes to a commit message (for example, to add more context for a change or adhere to our [commit message guidelines](./COMMIT_MESSAGE_CONVENTION.md)). In order to update the commit message of the last commit on your branch:
1. Check out your branch:
```
git checkout my-fix-branch
```
2. Amend the last commit and modify the commit message:
```
git commit --amend
```
3. Push to your GitHub repository:
```
git push --force-with-lease
```
> NOTE:
> If you need to update the commit message of an earlier commit, you can use `git rebase` in interactive mode. See the [git docs](https://git-scm.com/docs/git-rebase#_interactive_mode) for more details.
#### After your pull request is merged
After your pull request is merged, you can safely delete your branch and pull the changes from the main (upstream) repository:
- Delete the remote branch on GitHub either through the GitHub web UI or your local shell as follows:
```
git push origin --delete my-fix-branch
```
- Check out the master branch:
```
git checkout master -f
```
- Delete the local branch:
```
git branch -D my-fix-branch
```
- Update your master with the latest upstream version:
```
git pull --ff upstream master
```
## Coding Rules
To ensure consistency throughout the source code, keep these rules in mind as you are working:
- All features or bug fixes **must be tested** by one or more specs (unit-tests).
- All public API methods **must be documented**.
- We use Prettier as an automatic code formatter. Run `npm run prettier` after making any changes to the code.
## Credits
Thank you to all the people who have already contributed to Galacean!
// WIP: Contributors