You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: CONTRIBUTING.md
+49Lines changed: 49 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -35,3 +35,52 @@ And when creating apps with a starter:
35
35
```bash
36
36
node [root of the monorepo]/cli/create-tsrouter-app/dist/index.js app-js --starter http://localhost:9080/starter.json
37
37
```
38
+
39
+
# Developing on the CTA UI
40
+
41
+
The CTA UI is somewhat tricky to develop on because it's both a web server and a React app. You need to run the CLI in "API" model and then the React app in dev mode, as well as the whole monorepo in watch mode.
42
+
43
+
## Starting the API Server
44
+
45
+
Let's start off with how to run the CLI in "API" mode. Here we are running the CLI in an empty directory in app creation mode.
If this is working you will see the following output:
52
+
53
+
```
54
+
Create TanStack API is running on http://localhost:8080
55
+
```
56
+
57
+
Note that it say "Create TanStack **API**" and not "Create TanStack **App**". This is important. This means that the CLI is providing API endpoints, but **not** serving the static build files of the React app.
Now that we have the API server running, we can start the React app in dev mode.
68
+
69
+
```bash
70
+
cd packages/cta-ui
71
+
pnpm dev:ui
72
+
```
73
+
74
+
At this poing you should be able to navigate to `http://localhost:3000` and see the React app connected to the API server on `http://localhost:8080`.
75
+
76
+
## Running the Monorepo in Watch Mode
77
+
78
+
At the top level of the monorepo, run the following command to start the build in watch mode.
79
+
80
+
```bash
81
+
pnpm dev
82
+
```
83
+
84
+
This will build the monorepo and watch for changes in any of the libraries. (It will **not** build changes for the React app within the `cta-ui` package.)
85
+
86
+
This is important because you might need to change API endpoints in the CTA library, or in the engine. If you do make those kinds of changes then the you will need to re-run the CLI in "API" mode to pick up the changes.
|`pnpm build`| Builds **both** the library and the React app |
10
+
|`pnpm build:ui`| Builds the React app only |
11
+
|`pnpm build:lib`| Builds just the `lib` directory |
12
+
|`pnpm dev:ui`| Uses Vite to run the React app in dev mode |
13
+
|`pnpm dev`| Builds the `lib` directory in watch mode |
14
+
|`pnpm test`| Runs the tests |
15
+
|`pnpm test:watch`| Runs the tests in watch mode |
16
+
|`pnpm test:coverage`| Runs the tests and generates a coverage report |
17
+
18
+
## Dev vs Prod Mode
19
+
20
+
The only difference between dev and prod mode (outside of the usual minification and tree-shaking that goes into prod builds) is that in development mode the `src/lib/api.ts` uses a base URL of `http://localhost:8080` to point at the CLI running in API mode.
0 commit comments