If you have found what you think is a bug, and for usage questions, please start a discussion.
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.
If you want to contribute to the documentation:
- Fork Zustand into your Github account;
- Clone your fork locally;
- Separately, clone the pmndrs/website repo
(you don't need to fork it);
- This repo runs most of the doc websites under the pmndrs banner, including React Three Fiber and Zustand
- Switch to the
docs
branch;
- Now, you should have two repositories locally.
- Inside the website directory, run
npm install
and thennpm run dev
;- This will launch the website locally. You should be able to open and see the various documentation sites.
- One little catch here is that the website reads directly from Github, not locally.
As a temporary measure, you can do the following
(don't commit any changes made in the pmndrs/website repo):
- In your own Zustand fork, create a new working branch
(further related to as
[your-branch]
); - Inside website codebase, open
src/data/libraries.ts
; - Within the
zustand
key, changedocs: 'pmndrs/zustand/main/docs'
todocs: '[your-username]/zustand/[your-branch]/docs'
;- For example,
docs: 'chrisk-7777/zustand/docs-test/docs'
,
- For example,
- 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
);
- Sometimes you may have to also remove the
- Visit the Zustand docs locally and you should see the content you've just pushed.
- In your own Zustand fork, create a new working branch
(further related to as
- 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;
- If you are okay with
- Jump back to the official repo and open a PR from the branch you chose.
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;
- Create a new feature branch based on the
main
branch; - Install dependencies by running
yarn
(version 1); - Create failing tests for your fix or new feature;
- Implement your changes and confirm that all test are passing.
You can run the tests continuously during development
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.
- Either use
- Commit your changes (see the committing guidelines).
- Submit a PR for review.
We are applying conventional commits here. In short, that means a commit has to be one of the following types:
- feat: A new feature.
- fix: A bug fix.
- docs: Documentation-only changes.
- refactor: A code change that neither fixes a bug nor adds a feature.
- test: Adding missing or correcting existing tests.
- chore: Changes to the build process or auxiliary tools and libraries, 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
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.
Thank you for contributing! ❤️