Open History to see the last commit
1# Contributing
2β
3## Questions
4β
5If you have questions about implementation details, help or support, then please use our dedicated community forum at [GitHub Discussions](https://github.com/TanStack/query/discussions) **PLEASE NOTE:** If you choose to instead open an issue for your question, your issue will be immediately closed and redirected to the forum.
6β
7## Reporting Issues
8β
9If you have found what you think is a bug, please [file an issue](https://github.com/TanStack/query/issues/new/choose). **PLEASE NOTE:** Issues that are identified as implementation questions or non-issues will be immediately closed and redirected to [GitHub Discussions](https://github.com/TanStack/query/discussions)
10β
11## Suggesting new features
12β
13If you are here to suggest a feature, first create an issue 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.
14β
15## Development
16β
17If you have been assigned to fix an issue or develop a new feature, please follow these steps to get started:
18β
19- Fork this repository.
20- Install dependencies
21β
22 ```bash
23 pnpm install
24 ```
25β
26 - We use [pnpm](https://pnpm.io/) v9 for package management (run in case of pnpm-related issues).
27β
28 ```bash
29 corepack enable && corepack prepare
30 ```
31β
32 - We use [nvm](https://github.com/nvm-sh/nvm) to manage node versions - please make sure to use the version mentioned in `.nvmrc`
33β
34 ```bash
35 nvm use
36 ```
37β
38- Build all packages.
39β
40 ```bash
41 pnpm build:all
42 ```
43β
44- Run development server.
45β
46 ```bash
47 pnpm run watch
48 ```
49β
50- Implement your changes and tests to files in the `src/` directory and corresponding test files.
51- Document your changes in the appropriate doc page.
52- Git stage your required changes and commit (see below commit guidelines).
53- Submit PR for review.
54β
55### Running examples
56β
57- Make sure you've installed the dependencies in the repo's root directory.
58β
59 ```bash
60 pnpm install
61 ```
62β
63- If you want to run the example against your local changes, run below in the repo's root directory. Otherwise, it will be run against the latest TanStack Query release.
64β
65 ```bash
66 pnpm run watch
67 ```
68β
69- Run below in the selected examples' directory.
70β
71 ```bash
72 pnpm run dev
73 ```
74β
75#### Note on `examples/react-native`
76β
77React Native example requires Expo to work. Please follow the instructions from example's README.md file to learn more.
78β
79#### Note on standalone execution
80β
81If you want to run an example without installing dependencies for the whole repo, just follow instructions from the example's README.md file. It will be then run against the latest TanStack Query release.
82β
83## Online one-click setup
84β
85You can use Gitpod (An Online Open Source VS Code like IDE which is free for Open Source) for developing online. With a single click it will start a workspace and automatically:
86β
87- clone the `TanStack/query` repo.
88- install all the dependencies in `/` and `/docs`.
89- run below in the root(`/`) to Auto-build files.
90β
91 ```bash
92 npm start
93 ```
94β
95- run below in `/docs`.
96β
97 ```bash
98 npm run dev
99 ```
100β
101[](https://gitpod.io/#https://github.com/TanStack/query)
102β
103## Commit message conventions
104β
105`TanStack/query` is using [Angular Commit Message Conventions](https://github.com/angular/angular.js/blob/master/DEVELOPERS.md#-git-commit-guidelines).
106β
107We have very precise rules over how our git commit messages can be formatted. This leads to **more readable messages** that are easy to follow when looking through the **project history**.
108β
109### Commit Message Format
110β
111Each commit message consists of a **header**, a **body** and a **footer**. The header has a special
112format that includes a **type**, a **scope** and a **subject**:
113β
114```text
115<type>(<scope>): <subject>
116<BLANK LINE>
117<body>
118<BLANK LINE>
119<footer>
120```
121β
122The **header** is mandatory and the **scope** of the header is optional.
123β
124Any line of the commit message cannot be longer than 100 characters! This allows the message to be easier to read on GitHub as well as in various git tools.
125β
126### Type
127β
128Must be one of the following:
129β
130- **feat**: A new feature
131- **fix**: A bug fix
132- **docs**: Documentation only changes
133- **style**: Changes that do not affect the meaning of the code (white-space, formatting, missing semicolons, etc.)
134- **refactor**: A code change that neither fixes a bug nor adds a feature
135- **perf**: A code change that improves performance
136- **test**: Adding missing or correcting existing tests
137- **chore**: Changes to the build process or auxiliary tools and libraries such as documentation generation
138β
139### Scope
140β
141The scope could be anything specifying place of the commit change. For example `query-core`, `react-query` etc...
142β
143You can use `*` when the change affects more than a single scope.
144β
145### Subject
146β
147The subject contains succinct description of the change:
148β
149- use the imperative, present tense: "change" not "changed" nor "changes"
150- don't capitalize first letter
151- no dot (.) at the end
152β
153### Body
154β
155Just as in the **subject**, use the imperative, present tense: "change" not "changed" nor "changes". The body should include the motivation for the change and contrast this with previous behavior.
156β
157### Footer
158β
159The footer should contain any information about **Breaking Changes** and is also the place to [reference GitHub issues that this commit closes](https://help.github.com/en/github/managing-your-work-on-github/linking-a-pull-request-to-an-issue).
160β
161**Breaking Changes** should start with the word `BREAKING CHANGE:` with a space or two newlines. The rest of the commit message is then used for this.
162β
163### Example
164β
165Here is an example of the release type that will be done based on a commit messages:
166β
167| Commit message | Release type |
168| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------- |
169| fix(pencil): stop graphite breaking when too much pressure applied | Patch Release |
170| feat(pencil): add `graphiteWidth` option | ~~Minor~~ Feature Release |
171| perf(pencil): remove `graphiteWidth` option<br/><br/>BREAKING CHANGE: The `graphiteWidth` option has been removed.<br/>The default graphite width of 10mm is always used for performance reasons. | ~~Major~~ Breaking Release |
172β
173### Revert
174β
175If the commit reverts a previous commit, it should begin with `revert:`, followed by the header of the reverted commit. In the body it should say: `This reverts commit <hash>.`, where the hash is the SHA of the commit being reverted.
176β
177## Pull requests
178β
179Maintainers merge pull requests by squashing all commits and editing the commit message if necessary using the GitHub user interface.
180β
181Use an appropriate commit type. Be especially careful with breaking changes.
182β
183## Releases
184β
185For each new commit added to `main` with `git push` or by merging a pull request or merging from another branch, a GitHub action is triggered and runs the `semantic-release` command to make a release if there are codebase changes since the last release that affect the package functionalities.