Skip to content

Commit 0beabe5

Browse files
authored
docs: update CONTRIBUTING.md (#2986)
* docs: update CONTRIBUTING.md * docs(CONTRIBUTING.md): update documentation section including 'pnmdrs/docs' * docs(CONTRIBUTING.md): add period * docs(CONTRIBUTING.md): sepatate 'installing' and 'starting dev server' * docs(CONTRIBUTING.md): unify the tone of the command part
1 parent bc3e94e commit 0beabe5

File tree

1 file changed

+61
-91
lines changed

1 file changed

+61
-91
lines changed

CONTRIBUTING.md

Lines changed: 61 additions & 91 deletions
Original file line numberDiff line numberDiff line change
@@ -1,120 +1,90 @@
11
# Contributing
22

3-
## Reporting Issues
4-
5-
If you have found what you think is a bug,
6-
and for usage questions,
7-
please [start a discussion].
8-
9-
## Suggesting new features
10-
11-
If you are here to suggest a feature,
12-
first [start a discussion] if it does not already exist.
13-
From there, we will discuss use-cases for the feature,
14-
and then finally discuss how it could be implemented.
15-
16-
[start a discussion]: https://github.com/pmndrs/zustand/discussions/new
17-
18-
## Documentation
19-
20-
If you want to contribute to the [documentation](./docs/):
21-
22-
- [Fork Zustand](https://github.com/pmndrs/zustand/fork) into your Github account;
23-
- Clone your fork locally;
24-
- Separately, clone the [pmndrs/website repo](https://github.com/pmndrs/website)
25-
(you don't need to fork it);
26-
- This repo runs most of the doc websites under the pmndrs banner,
27-
including React Three Fiber and Zustand
28-
- Switch to the `docs` branch;
29-
- Now, you should have two repositories locally.
30-
- Inside the website directory, run `npm install` and then `npm run dev`;
31-
- This will launch the website locally.
32-
You should be able to open and see the various documentation sites.
33-
- One little catch here is that the website reads directly from Github, not locally.
34-
As a temporary measure, you can do the following
35-
(don't commit any changes made in the pmndrs/website repo):
36-
- In your own Zustand fork, create a new working branch
37-
(further related to as `[your-branch]`);
38-
- Inside website codebase, open `src/data/libraries.ts`;
39-
- Within the `zustand` key,
40-
change `docs: 'pmndrs/zustand/main/docs'`
41-
to `docs: '[your-username]/zustand/[your-branch]/docs'`;
42-
- For example, `docs: 'chrisk-7777/zustand/docs-test/docs'`,
43-
- Now, inside your Zustand fork,
44-
make the appropriate changes to the documentation files in the `docs` folder;
45-
- Commit and push those changes to `[your-branch]` in your Zustand fork;
46-
- Commit messages follow the [conventional commits] style.
47-
See the [committing guidelines].
48-
- Restart the website locally (`control + c` -> `npm run dev`);
49-
- Sometimes you may have to also remove the `temp` directory
50-
in the website directory (`rm -r temp`);
51-
- Visit the Zustand docs locally
52-
and you should see the content you've just pushed.
53-
- Once you are happy with your changes:
54-
- If you are okay with `[your-branch]` name, use it for the PR, or
55-
- Create a new branch and push the changes to that one.
56-
- For now there are no formal naming conventions for branches;
57-
- Jump back to the [official repo](https://github.com/pmndrs/zustand)
58-
and open a PR from the branch you chose.
59-
60-
## Development
61-
62-
If you would like to contribute by fixing an open issue
63-
or developing a new feature,
64-
you can use this suggested workflow:
65-
66-
- Fork this repository;
67-
- Create a new feature branch based on the `main` branch;
68-
- Install dependencies by running `pnpm install`;
69-
- Create failing tests for your fix or new feature;
70-
- Implement your changes and confirm that all test are passing.
71-
You can run the tests continuously during development
72-
with the `pnpm test` command.
73-
- If you want to test it in a React project:
74-
- Either use `pnpm link`, or
75-
- Use the `yalc` package.
76-
- Commit your changes (see the [committing guidelines]).
77-
- Submit a PR for review.
78-
79-
[committing guidelines]: #committing
3+
## General Guideline
4+
5+
### Reporting Issues
6+
7+
If you have found what you think is a bug, please [start a discussion](https://github.com/pmndrs/zustand/discussions/new?category=bug-report).
8+
9+
For any usage questions, please [start a discussion](https://github.com/pmndrs/zustand/discussions/new?category=q-a).
10+
11+
### Suggesting New Features
12+
13+
If you are here to suggest a feature, first [start a discussion](https://github.com/pmndrs/zustand/discussions/new?category=ideas) 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.
8014

8115
### Committing
8216

83-
We are applying [conventional commits] here.
84-
In short, that means a commit has to be one of the following types:
17+
We are applying [conventional commit spec](https://www.conventionalcommits.org/en/v1.0.0/) here. In short, that means a commit has to be one of the following types:
18+
19+
Your commit type must be one of the following:
8520

8621
- **feat**: A new feature.
8722
- **fix**: A bug fix.
88-
- **docs**: Documentation-only changes.
8923
- **refactor**: A code change that neither fixes a bug nor adds a feature.
24+
- **chore**: Changes to the build process, configuration, dependencies, CI/CD pipelines, or other auxiliary tools and libraries.
25+
- **docs**: Documentation-only changes.
9026
- **test**: Adding missing or correcting existing tests.
91-
- **chore**: Changes to the build process or auxiliary tools and libraries,
92-
such as documentation generation
9327

9428
If you are unfamiliar with the usage of conventional commits,
9529
the short version is to simply specify the type as a first word,
9630
and follow it with a colon and a space, then start your message
9731
from a lowercase letter, like this:
9832

9933
```
100-
feat: add a 'BearStorage' storage type support
34+
feat: add a 'foo' type support
10135
```
10236

10337
You can also specify the scope of the commit in the parentheses after a type:
10438

10539
```
106-
fix(middleware): change the bear parameter in devtools
40+
fix(react): change the 'bar' parameter type
10741
```
10842

109-
[conventional commits]: https://www.conventionalcommits.org/en/v1.0.0/
43+
### Development
44+
45+
If you would like to contribute by fixing an open issue or developing a new feature you can use this suggested workflow:
46+
47+
#### General
48+
49+
1. Fork this repository.
50+
2. Create a new feature branch based off the `main` branch.
51+
3. Follow the [Core](#Core) and/or the [Documentation](#Documentation) guide below and come back to this once done.
52+
4. Run `pnpm run fix:format` to format the code.
53+
5. Git stage your required changes and commit (review the commit guidelines below).
54+
6. Submit the PR for review.
55+
56+
##### Core
57+
58+
1. Run `npm install` to install dependencies.
59+
2. Create failing tests for your fix or new feature in the [`tests`](./tests/) folder.
60+
3. Implement your changes.
61+
4. Run `pnpm run build` to build the library. _(Pro-tip: `pnpm run build-watch` runs the build in watch mode)_
62+
5. Run the tests by running `pnpm run test` and ensure that they pass.
63+
6. You can use `pnpm link` to sym-link this package and test it locally on your own project. Alternatively, you may use CodeSandbox CI's canary releases to test the changes in your own project. (requires a PR to be created first)
64+
7. Follow step 4 and onwards from the [General](#General) guide above to bring it to the finish line.
65+
66+
### Pull Requests
67+
68+
Please try to keep your pull request focused in scope and avoid including unrelated commits.
69+
70+
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 request improvements, therefore, please check ✅ ["Allow edits from maintainers"](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/creating-a-pull-request-from-a-fork) on your PR.
71+
72+
## Zustand-specific Guideline
11073

111-
## Pull requests
74+
##### Documentation
11275

113-
Please try to keep your pull requests focused and small in scope,
114-
and avoid including unrelated commits.
76+
Our [docs](https://zustand.docs.pmnd.rs) are based on [`pmndrs/docs`](https://github.com/pmndrs/docs).
11577

116-
After you have submitted your pull request,
117-
we'll try to get back to you as soon as possible.
118-
We may suggest some changes or improvements.
78+
1. Separately, clone the `pmndrs/docs`. (you don't need to fork it).
79+
2. Inside the `pmndrs/docs` directory:
80+
1. Create a `.env` file in the root directory with the next environment variables: `MDX=docs/zustand/docs` and `HOME_REDIRECT=/getting-started/introduction`.
81+
2. Run `npm install` to install dependencies.
82+
3. Run `npm run dev` to start the dev server.
83+
4. Navigate to [`http://localhost:3000`](http://localhost:3000) to view the documents.
84+
3. Go Back to the forked repository:
85+
1. Run `pnpm install` to install dependencies.
86+
2. Navigate to the [`docs`](./docs/) folder and make necessary changes to the documents.
87+
3. Add your changes to the documents and see them live reloaded in the browser. (if you don't see changes, try `control + c`, then run `npm run dev` in the cloned `pnmdrs/docs` repository)
88+
4. Follow step 4 and onwards from the [General](#General) guide above to bring it to the finish line.
11989

12090
Thank you for contributing! :heart:

0 commit comments

Comments
 (0)