docs(contributing): reformat and fix typos, extend the committing guide (#1592)

This commit is contained in:
Blazej Sewera 2023-02-02 12:19:51 +01:00 committed by GitHub
parent ab4118d395
commit d2700adfff
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -2,66 +2,120 @@
## Reporting Issues ## Reporting Issues
If you have found what you think is a bug, please [start a discussion](https://github.com/pmndrs/zustand/discussions/new). If you have found what you think is a bug,
and for usage questions,
Also for usage questions, please [start a discussion](https://github.com/pmndrs/zustand/discussions/new). please [start a discussion].
## Suggesting new features ## Suggesting new features
If you are here to suggest a feature, first [start a discussion](https://github.com/pmndrs/zustand/discussions/new) if it does not already exist. From there, we will discuss use-cases for the feature and then finally discuss how it could be implemented. If you are here to suggest a feature,
first [start a discussion] if it does not already exist.
From there, we will discuss use-cases for the feature,
and then finally discuss how it could be implemented.
[start a discussion]: https://github.com/pmndrs/zustand/discussions/new
## Documentation ## Documentation
- Fork the [Zustand repo](https://github.com/pmndrs/zustand/) into your own Github account If you want to contribute to the [documentation](./docs/):
- Locally, clone down your fork
- Separately, clone the [Pmdrs-Website](https://github.com/pmndrs/website} - [Fork Zustand](https://github.com/pmndrs/zustand/fork) into your Github account;
- this runs most of the doc websites under the pmndrs banner, including React Three Fiber and Zustand - Clone your fork locally;
- Switch to the `docs`-branch. - Separately, clone the [pmndrs/website repo](https://github.com/pmndrs/website)
- Now, you should have two repositories locally (you don't need to fork it);
- Inside the website folder, run `npm install` and then `npm run dev` - This repo runs most of the doc websites under the pmndrs banner,
- This will launch the website locally. You should be able to open and see the various documentation sites including React Three Fiber and Zustand
- One little catch here is that the website reads directly from Github, not locally. As a temporary measure, you can do the following (without actually committing these changes): - Switch to the `docs` branch;
- Inside website codebase, open `src/data/libraries.ts` - Now, you should have two repositories locally.
- Within the `Zustand` key, change `docs: 'pmndrs/zustand/main/docs`, to `docs: '[username]/zustand/[test-branch]/docs'`, - Inside the website directory, run `npm install` and then `npm run dev`;
- For example,`docs: 'chrisk-7777/zustand/docs-test/docs'`, - This will launch the website locally.
- Now, inside your Zustand fork, make the appropriate changes to the `.md` files in the `/docs` folder You should be able to open and see the various documentation sites.
- Push those changes up to your fork on a branch such as `docs-test` (_this should match whatever you set it to above in `libraries.ts`_ - One little catch here is that the website reads directly from Github, not locally.
- Restart the website locally (`control + c` -> `npm run dev`) As a temporary measure, you can do the following
- Visit the Zustand docs locally, and you should see the content you just pushed up (don't commit any changes made in the pmndrs/website repo):
- Once you are happy with your changes, commit them to a real branch and push up to your fork - In your own Zustand fork, create a new working branch
- For now there are no formal naming conventions for branches. (further related to as `[your-branch]`);
- Commit messages follow a [conventional commit](#committing) style. - Inside website codebase, open `src/data/libraries.ts`;
- Jump back to the official repo (this one) and raise a PR from the branch you just pushed up - Within the `zustand` key,
change `docs: 'pmndrs/zustand/main/docs'`
to `docs: '[your-username]/zustand/[your-branch]/docs'`;
- For example, `docs: 'chrisk-7777/zustand/docs-test/docs'`,
- Now, inside your Zustand fork,
make the appropriate changes to the documentation files in the `docs` folder;
- Commit and push those changes to `[your-branch]` in your Zustand fork;
- Commit messages follow the [conventional commits] style.
See the [committing guidelines].
- Restart the website locally (`control + c` -> `npm run dev`);
- Sometimes you may have to also remove the `temp` directory
in the website directory (`rm -r temp`);
- Visit the Zustand docs locally
and you should see the content you've just pushed.
- Once you are happy with your changes:
- If you are okay with `[your-branch]` name, use it for the PR, or
- Create a new branch and push the changes to that one.
- For now there are no formal naming conventions for branches;
- Jump back to the [official repo](https://github.com/pmndrs/zustand)
and open a PR from the branch you chose.
## Development ## Development
If you would like to contribute by fixing an open issue or developing a new feature you can use this suggested workflow: If you would like to contribute by fixing an open issue
or developing a new feature,
you can use this suggested workflow:
- Fork this repository. - Fork this repository;
- Create a new feature branch based off the `main` branch. - Create a new feature branch based on the `main` branch;
- Install dependencies by running `$ yarn`. [(version 1)](https://classic.yarnpkg.com/lang/en/docs/install) - Install dependencies by running `yarn`
- Create failing tests for your fix or new feature. ([version 1](https://classic.yarnpkg.com/lang/en/docs/install));
- Implement your changes and confirm that all test are passing. You can run the tests continuously during development via the `$ yarn test:dev` command. - Create failing tests for your fix or new feature;
- If you want to test it in a React project you can either use `$ yarn link` or the `yalc` package. - Implement your changes and confirm that all test are passing.
- Git stage your required changes and commit (see below commit guidelines). You can run the tests continuously during development
- Submit PR for review. with the `yarn test:dev` command.
- If you want to test it in a React project:
- Either use `yarn link`, or
- Use the `yalc` package.
- Commit your changes (see the [committing guidelines]).
- Submit a PR for review.
[committing guidelines]: #committing
### Committing ### Committing
We are applying the ideas of [conventional commits](https://www.conventionalcommits.org/en/v1.0.0/) here. In short that means that commit has to be one of the following (a _type_ in conventional commit speech): We are applying [conventional commits] here.
In short, that means a commit has to be one of the following types:
- **feat**: A new feature - **feat**: A new feature.
- **fix**: A bug fix - **fix**: A bug fix.
- **docs**: Documentation only changes - **docs**: Documentation-only changes.
- **refactor**: A code change that neither fixes a bug nor adds a feature - **refactor**: A code change that neither fixes a bug nor adds a feature.
- **test**: Adding missing or correcting existing tests - **test**: Adding missing or correcting existing tests.
- **chore**: Changes to the build process or auxiliary tools and libraries such as documentation - **chore**: Changes to the build process or auxiliary tools and libraries,
generation such as documentation generation
If you are unfamiliar with the usage of conventional commits,
the short version is to simply specify the type as a first word,
and follow it with a colon and a space, then start your message
from a lowercase letter, like this:
```
feat: add a 'BearStorage' storage type support
```
You can also specify the scope of the commit in the parentheses after a type:
```
fix(middleware): change the bear parameter in devtools
```
[conventional commits]: https://www.conventionalcommits.org/en/v1.0.0/
## Pull requests ## Pull requests
Please try to keep your pull request focused in scope and avoid including unrelated commits. Please try to keep your pull requests focused and small in scope,
and avoid including unrelated commits.
After you have submitted your pull request, we'll try to get back to you as soon as possible. We may suggest some changes or improvements. After you have submitted your pull request,
we'll try to get back to you as soon as possible.
We may suggest some changes or improvements.
Thank you for contributing! :heart: Thank you for contributing! :heart: