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/form/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/form/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/form/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 by running `$ pnpm install`.
21 - We use [pnpm](https://pnpm.io/) v7 for package management.
22 - We use [nvm](https://github.com/nvm-sh/nvm) to manage node versions - please make sure to use the version mentioned in `.nvmrc`.
23- Run development server using `pnpm run watch`.
24- Implement your changes and tests to files in the `src/` directory and corresponding test files.
25- Document your changes in the appropriate doc page.
26- Git stage your required changes and commit (see below commit guidelines).
27- Submit PR for review.
28β
29### Editing the docs locally and previewing the changes
30β
31The documentations for all the TanStack projects are hosted on [tanstack.com](https://tanstack.com), which is a Remix application (https://github.com/TanStack/tanstack.com). You need to run this app locally to preview your changes in the `TanStack/form` docs.
32β
33> [!NOTE]
34> The Remix app fetches the doc pages from GitHub in production, and searches for them at `../form/docs` in development. Your local clone of `TanStack/form` needs to be in the same directory as the local clone of `TansStack/tanstack.com`.
35β
36You can follow these steps to set up the docs for local development:
37β
381. Make a new directory called `tanstack`.
39β
40```sh
41mkdir tanstack
42```
43β
442. Enter that directory and clone the [`TanStack/form`](https://github.com/TanStack/form) and [`TanStack/tanstack.com`](https://github.com/TanStack/tanstack.com) repos.
45β
46```sh
47cd tanstack
48git clone git@github.com:TanStack/form.git
49# We probably don't need all the branches and commit history
50# from the `tanstack.com` repo, so let's just create a shallow
51# clone of the latest version of the `main` branch.
52# Read more about shallow clones here:
53# https://github.blog/2020-12-21-get-up-to-speed-with-partial-clone-and-shallow-clone/#user-content-shallow-clones
54git clone git@github.com:TanStack/tanstack.com.git --depth=1 --single-branch --branch=main
55```
56β
57> [!NOTE]
58> Your `tanstack` directory should look like this:
59>
60> ```
61> tanstack/
62> |
63> +-- form/ (<-- this directory cannot be called anything else!)
64> |
65> +-- tanstack.com/
66> ```
67β
683. Enter the `tanstack/tanstack.com` directory, install the dependencies and run the app in dev mode:
69β
70```sh
71cd tanstack.com
72pnpm i
73# The app will run on https://localhost:3000 by default
74pnpm dev
75```
76β
774. Now you can visit http://localhost:3000/form/latest/docs/overview in the browser and see the changes you make in `tanstack/form/docs` there.
78β
79> [!WARNING]
80> You will need to update the `docs/config.json` file (in `TanStack/form`) if you add a new documentation page!
81β
82You can see the whole process in the screen capture below:
83β
84https://github.com/fulopkovacs/form/assets/43729152/9d35a3c3-8153-4e74-9cb2-af275f7a269b
85β
86### Running examples
87β
88- Make sure you've installed the dependencies by running `$ pnpm install` in the repo's root directory.
89- If you want to run the example against your local changes, run `pnpm run watch` in the repo's root directory. Otherwise, it will be run against the latest TanStack Form release.
90- Run `pnpm run dev` in the selected examples' directory.
91β
92#### Note on `examples/react-native`
93β
94React Native example requires Expo to work. Please follow the instructions from example's README.md file to learn more.
95β
96#### Note on standalone execution
97β
98If 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 Form release.
99β
100## Online one-click setup
101β
102You 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:
103β
104- clone the `TanStack/form` repo.
105- install all the dependencies in `/` and `/docs`.
106- run `npm start` in the root(`/`) to Auto-build files.
107- run `npm run dev` in `/docs`.
108β
109[](https://gitpod.io/#https://github.com/TanStack/form)
110β
111## Commit message conventions
112β
113`TanStack/form` is using [Angular Commit Message Conventions](https://github.com/angular/angular.js/blob/master/DEVELOPERS.md#-git-commit-guidelines).
114β
115We 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**.
116β
117### Commit Message Format
118β
119Each commit message consists of a **header**, a **body** and a **footer**. The header has a special
120format that includes a **type**, a **scope** and a **subject**:
121β
122```
123<type>(<scope>): <subject>
124<BLANK LINE>
125<body>
126<BLANK LINE>
127<footer>
128```
129β
130The **header** is mandatory and the **scope** of the header is optional.
131β
132Any 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.
133β
134### Type
135β
136Must be one of the following:
137β
138- **feat**: A new feature
139- **fix**: A bug fix
140- **docs**: Documentation only changes
141- **style**: Changes that do not affect the meaning of the code (white-space, formatting, missing
142 semi-colons, etc)
143- **refactor**: A code change that neither fixes a bug nor adds a feature
144- **perf**: A code change that improves performance
145- **test**: Adding missing or correcting existing tests
146- **chore**: Changes to the build process or auxiliary tools and libraries such as documentation
147 generation
148β
149### Scope
150β
151The scope could be anything specifying place of the commit change. For example `useForm`, `useMutation` etc...
152β
153You can use `*` when the change affects more than a single scope.
154β
155### Subject
156β
157The subject contains succinct description of the change:
158β
159- use the imperative, present tense: "change" not "changed" nor "changes"
160- don't capitalize first letter
161- no dot (.) at the end
162β
163### Body
164β
165Just 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.
166β
167### Footer
168β
169The 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).
170β
171**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.
172β
173### Example
174β
175Here is an example of the release type that will be done based on a commit messages:
176β
177| Commit message | Release type |
178| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -------------------------- |
179| `fix(pencil): stop graphite breaking when too much pressure applied` | Patch Release |
180| `feat(pencil): add 'graphiteWidth' option` | ~~Minor~~ Feature Release |
181| `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 |
182β
183### Revert
184β
185If 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.
186β
187## Pull requests
188β
189Maintainers merge pull requests by squashing all commits and editing the commit message if necessary using the GitHub user interface.
190β
191Use an appropriate commit type. Be especially careful with breaking changes.
192β
193## Releases
194β
195For 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.