Open History to see the last commit
1# Contributing
2β
3- Clone the repo
4 - `gh repo clone TanStack/router`
5- Ensure `node` is installed
6 - https://nodejs.org/en/
7- Ensure `pnpm` is installed
8 - https://pnpm.io/installation
9 - Why? We use `pnpm` to manage workspace dependencies. It's easily the best monorepo/workspace experience available as of when this was written.
10- Install dependencies
11 - `pnpm install`
12 - This installs dependencies for all of the packages in the monorepo, even examples!
13 - Dependencies inside of the packages and examples are automatically linked together as local/dynamic dependencies.
14- Install test dependencies
15 - `pnpm exec playwright install` (required for e2e tests)
16- Run the build or dev watcher
17 - `pnpm build:all` (build all packages) or
18 - `pnpm build` (cached build with [nx affected](https://nx.dev/nx-api/nx/documents/affected)) or
19 - `pnpm dev`
20- Navigate to an example
21 - `cd examples/react/basic`
22- Run the example
23 - `pnpm dev`
24- Make changes to the code
25 - If you ran `pnpm dev` the dev watcher will automatically rebuild the code that has changed
26- Editing the docs locally and previewing the changes
27 - The documentations for all the TanStack projects are 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/router` docs.
28β
29> [!NOTE]
30> The website fetches the doc pages from GitHub in production, and searches for them at `../router/docs` in development. Your local clone of `TanStack/router` needs to be in the same directory as the local clone of `TanStack/tanstack.com`.
31β
32You can follow these steps to set up the docs for local development:
33β
341. Make a new directory called `tanstack`.
35β
36```sh
37mkdir tanstack
38```
39β
402. Enter that directory and clone the [`TanStack/router`](https://github.com/TanStack/router) and [`TanStack/tanstack.com`](https://github.com/TanStack/tanstack.com) repos.
41β
42```sh
43cd tanstack
44git clone git@github.com:TanStack/router.git
45# We probably don't need all the branches and commit history
46# from the `tanstack.com` repo, so let's just create a shallow
47# clone of the latest version of the `main` branch.
48# Read more about shallow clones here:
49# https://github.blog/2020-12-21-get-up-to-speed-with-partial-clone-and-shallow-clone/#user-content-shallow-clones
50git clone git@github.com:TanStack/tanstack.com.git --depth=1 --single-branch --branch=main
51```
52β
53> [!NOTE]
54> Your `tanstack` directory should look like this:
55>
56> ```
57> tanstack/
58> |
59> +-- router/ (<-- this directory cannot be called anything else!)
60> |
61> +-- tanstack.com/
62> ```
63β
643. Enter the `tanstack/tanstack.com` directory, install the dependencies and run the app in dev mode:
65β
66```sh
67cd tanstack.com
68pnpm i
69# The app will run on https://localhost:3000 by default
70pnpm dev
71```
72β
734. Now you can visit http://localhost:3000/router/latest/docs/framework/react/overview in the browser and see the changes you make in `tanstack/router/docs` there.
74β
75> [!WARNING]
76> You will need to update the `docs/(router or start)config.json` file (in `TanStack/router`) if you add a new documentation page!
77β
78You can see the whole process in the screen capture below:
79β
80https://github.com/fulopkovacs/form/assets/43729152/9d35a3c3-8153-4e74-9cb2-af275f7a269b