Skip to content
Source
Sign inSign up
TanStack/db
Open History to see the last commit

CONTRIBUTING.md

146 lines5.0 KB

1# Contributing
2​
3## Questions
4​
5If you have questions about implementation details, help, or support, please use our dedicated community forum at [GitHub Discussions](https://github.com/TanStack/db/discussions). **PLEASE NOTE:** If you choose to open an issue for your question instead, your issue may be 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/db/issues/new/choose). **PLEASE NOTE:** Issues that are identified as implementation questions or non-issues may be closed and redirected to [GitHub Discussions](https://github.com/TanStack/db/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 can discuss use cases for the feature and 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- Use the Node.js version mentioned in `.nvmrc`.
21​
22 ```bash
23 nvm use
24 ```
25​
26- Enable [Corepack](https://nodejs.org/api/corepack.html) so the [pnpm](https://pnpm.io/) version mentioned in `package.json` is used.
27​
28 ```bash
29 corepack enable
30 ```
31​
32- Install dependencies.
33​
34 ```bash
35 pnpm install
36 ```
37​
38- Build all packages.
39​
40 ```bash
41 pnpm build
42 ```
43​
44- Run tests.
45​
46 ```bash
47 pnpm test
48 ```
49​
50- Run linting.
51​
52 ```bash
53 pnpm lint
54 ```
55​
56- Implement your changes and tests in the relevant package or example.
57- Document your changes in the appropriate doc page.
58- Git stage your required changes and commit them.
59- Submit a PR for review.
60​
61### Editing the docs locally and previewing changes
62​
63The documentation for all TanStack projects is hosted on [tanstack.com](https://tanstack.com), which is a TanStack Start application (https://github.com/TanStack/tanstack.com). You need to run this app locally to preview your changes in the `TanStack/db` docs.
64​
65> [!NOTE]
66> The website fetches doc pages from GitHub in production, and searches for them at `../db/docs` in development. Your local clone of `TanStack/db` needs to be in the same directory as the local clone of `TanStack/tanstack.com`.
67​
68You can follow these steps to set up the docs for local development:
69​
701. Make a new directory called `tanstack`.
71​
72```sh
73mkdir tanstack
74```
75​
762. Enter that directory and clone the [`TanStack/db`](https://github.com/TanStack/db) and [`TanStack/tanstack.com`](https://github.com/TanStack/tanstack.com) repos.
77​
78```sh
79cd tanstack
80git clone git@github.com:TanStack/db.git
81# We probably don't need all the branches and commit history
82# from the `tanstack.com` repo, so let's just create a shallow
83# clone of the latest version of the `main` branch.
84# Read more about shallow clones here:
85# https://github.blog/2020-12-21-get-up-to-speed-with-partial-clone-and-shallow-clone/#user-content-shallow-clones
86git clone git@github.com:TanStack/tanstack.com.git --depth=1 --single-branch --branch=main
87```
88​
89> [!NOTE]
90> Your `tanstack` directory should look like this:
92> ```text
93> tanstack/
94> |
95> +-- db/ (<-- this directory cannot be called anything else!)
96> |
97> +-- tanstack.com/
98> ```
99​
1003. Enter the `tanstack/tanstack.com` directory, install the dependencies, and run the app in dev mode.
101​
102```sh
103cd tanstack.com
104pnpm i
105# The app will run on http://localhost:3000 by default
106pnpm dev
107```
108​
1094. Visit http://localhost:3000/db/latest/docs/overview in the browser and see the changes you make in `tanstack/db/docs` there.
110​
111> [!WARNING]
112> You will need to update `docs/config.json` if you add a new documentation page.
113​
114### Running examples
115​
116- Make sure you've installed dependencies in the repo's root directory.
117​
118 ```bash
119 pnpm install
120 ```
121​
122- If you want to run an example against your local changes, run the relevant package build/watch command from the repo root if needed. Otherwise, examples may run against the latest published TanStack DB release.
123​
124- Run the example from the selected example directory.
125​
126 ```bash
127 pnpm dev
128 ```
129​
130#### Note on standalone execution
131​
132If you want to run an example without installing dependencies for the whole repo, follow the instructions from the example's README.md file. It will then run against the latest TanStack DB release.
133​
134## Changesets
135​
136This repo uses [Changesets](https://github.com/changesets/changesets) to automate releases. If your PR should release a new package version (patch, minor, or major), please run `pnpm changeset` and commit the generated file. If your PR affects docs, examples, styles, etc., you probably don't need to generate a changeset.
137​
138## Pull requests
139​
140Maintainers merge pull requests by squashing all commits and editing the commit message if necessary using the GitHub user interface.
141​
142Use an appropriate commit type. Be especially careful with breaking changes.
143​
144## Releases
145​
146For each new commit added to `main`, a GitHub Workflow is triggered which runs the [Changesets Action](https://github.com/changesets/action). This generates a preview PR showing the impact of all changesets. When this PR is merged, the package will be published to npm.