@ea-lab/reactive-json-docs 0.1.9 → 0.1.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/public/rjbuild/docs/install.md +281 -51
- package/public/rjbuild/docs/install.yaml +622 -81
package/package.json
CHANGED
|
@@ -2,83 +2,166 @@
|
|
|
2
2
|
|
|
3
3
|
> **Tip**: In the interactive version of this documentation, a button is available to automatically copy the initialization prompt. Copy it and paste it into Cursor to start the step-by-step assistant.
|
|
4
4
|
|
|
5
|
-
## ⚠️ Important
|
|
5
|
+
## ⚠️ Important Rules
|
|
6
6
|
|
|
7
|
-
**
|
|
7
|
+
**NEVER SKIP STEPS** unless explicitly requested by the user. Each step is critical for the proper functioning of the project and must be executed in the defined chronological order.
|
|
8
|
+
|
|
9
|
+
When user feedback is required, wait for it and do not continue until this feedback is given.
|
|
10
|
+
|
|
11
|
+
Adapt commands according to the execution environment (Windows, Ubuntu, Mac...).
|
|
8
12
|
|
|
9
13
|
## Table of Contents
|
|
10
14
|
|
|
11
|
-
1. [
|
|
12
|
-
2. [
|
|
13
|
-
3. [
|
|
14
|
-
4. [
|
|
15
|
-
5. [
|
|
16
|
-
6. [
|
|
17
|
-
7. [
|
|
18
|
-
8. [
|
|
19
|
-
9. [
|
|
15
|
+
1. [Project Directory Confirmation](#1-project-directory-confirmation)
|
|
16
|
+
2. [Collecting User Information](#2-collecting-user-information)
|
|
17
|
+
3. [Documentation Repositories Setup](#3-documentation-repositories-setup)
|
|
18
|
+
4. [Cursor Workspace Configuration](#4-cursor-workspace-configuration)
|
|
19
|
+
5. [Vite Project Initialization](#5-vite-project-initialization)
|
|
20
|
+
6. [Project Structure Verification](#6-project-structure-verification)
|
|
21
|
+
7. [Dependencies Installation](#7-dependencies-installation)
|
|
22
|
+
8. [Cursor Project Rules Creation](#8-cursor-project-rules-creation)
|
|
23
|
+
9. [Generated Project Cleanup](#9-generated-project-cleanup)
|
|
24
|
+
10. [Basic Configuration with ReactiveJsonRoot](#10-basic-configuration-with-reactivejsonroot)
|
|
25
|
+
11. [Routing Configuration (Optional)](#11-routing-configuration-optional)
|
|
26
|
+
12. [Final Verification](#12-final-verification)
|
|
27
|
+
|
|
28
|
+
## Chronological Steps
|
|
29
|
+
|
|
30
|
+
### 1. Project Directory Confirmation
|
|
31
|
+
|
|
32
|
+
**Action:** Show the user if the IDE is opened in the directory where the project will
|
|
33
|
+
be initialized, then ask for confirmation:
|
|
34
|
+
|
|
35
|
+
- Execute the command:
|
|
36
|
+
```bash
|
|
37
|
+
pwd
|
|
38
|
+
```
|
|
39
|
+
- Show the user this info:
|
|
40
|
+
> **IMPORTANT: Directory Confirmation Required**
|
|
41
|
+
>
|
|
42
|
+
> **Current directory:** `[Display the result of pwd command]`
|
|
43
|
+
>
|
|
44
|
+
> **This directory will become your project root.** All project files will be created here.
|
|
45
|
+
- Ask the user for confirmation:
|
|
46
|
+
> **Do you confirm that this is the correct location before continuing?** If the location is wrong,
|
|
47
|
+
> please open in your IDE the location where the project will be created and restart the
|
|
48
|
+
> installation procedure.
|
|
49
|
+
- User feedback required.
|
|
50
|
+
- When user confirms, note the project directory as `<project_dir>` and go to the next step.
|
|
20
51
|
|
|
21
52
|
---
|
|
22
53
|
|
|
23
|
-
|
|
54
|
+
### 2. Collecting User Information
|
|
24
55
|
|
|
25
|
-
Ask the user for:
|
|
56
|
+
**Action:** Ask the user for the following information:
|
|
26
57
|
|
|
27
|
-
- **
|
|
28
|
-
- **
|
|
29
|
-
|
|
58
|
+
- **TypeScript**: Ask if the user wants to use TypeScript (yes/no)
|
|
59
|
+
- **Documentation repositories location**: Absolute path where to clone reactive-json and reactive-json-docs repositories. When the user gives a relative path, convert it to absolute
|
|
60
|
+
and ask for confirmation.
|
|
30
61
|
|
|
31
|
-
|
|
62
|
+
**Important:** For documentation location, **NEVER** place them in the current project directory. Propose by default: `~/cursor-docs/` or let the user specify another location outside the current project.
|
|
32
63
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
64
|
+
**Variables to remember:**
|
|
65
|
+
- `<use_typescript>`: true/false based on the answer
|
|
66
|
+
- `<docs_location>`: Absolute path for repositories (must be outside current directory)
|
|
67
|
+
|
|
68
|
+
**Validation:** Verify that `<docs_location>` is not within the current project directory.
|
|
69
|
+
When invalid, ask again the location with valid suggestions.
|
|
38
70
|
|
|
39
71
|
---
|
|
40
72
|
|
|
41
|
-
|
|
73
|
+
### 3. Documentation Repositories Setup
|
|
74
|
+
|
|
75
|
+
**Action:** Clone the required documentation repositories
|
|
76
|
+
|
|
77
|
+
**Commands to execute:**
|
|
42
78
|
|
|
43
79
|
```bash
|
|
80
|
+
mkdir -p <docs_location>
|
|
44
81
|
cd <docs_location>
|
|
45
82
|
git clone https://github.com/Ealab-collab/reactive-json.git
|
|
46
83
|
git clone https://github.com/Ealab-collab/reactive-json-docs.git
|
|
47
84
|
```
|
|
48
85
|
|
|
49
|
-
|
|
86
|
+
**Important:** Explain to the user that these repositories are **only** for Cursor to index the documentation and will **not** be included in the final project.
|
|
50
87
|
|
|
51
|
-
If repositories are already cloned, proceed directly to step
|
|
88
|
+
**Note:** If the user indicates that the repositories are already cloned, proceed directly to step 4 (Cursor Workspace Configuration) as it is essential to add the folders to the workspace even if they already exist.
|
|
52
89
|
|
|
53
90
|
---
|
|
54
91
|
|
|
55
|
-
|
|
92
|
+
### 4. Cursor Workspace Configuration
|
|
56
93
|
|
|
57
|
-
**
|
|
94
|
+
**Action:** Ask the user to add repositories to the workspace
|
|
58
95
|
|
|
59
|
-
|
|
60
|
-
2. Add `<docs_location>/reactive-json`
|
|
61
|
-
3. Add `<docs_location>/reactive-json-docs`
|
|
96
|
+
**Instructions to give to the user:**
|
|
62
97
|
|
|
63
|
-
|
|
98
|
+
> **IMPORTANT: Manual Action Required**
|
|
99
|
+
>
|
|
100
|
+
> Before continuing, you must add the cloned repositories to your Cursor workspace:
|
|
101
|
+
>
|
|
102
|
+
> 1. Go to `File > Add Folder to Workspace`
|
|
103
|
+
> 2. Add the folder `<docs_location>/reactive-json`
|
|
104
|
+
> 3. Add the folder `<docs_location>/reactive-json-docs`
|
|
105
|
+
>
|
|
106
|
+
> **Confirm that this step is completed before continuing.**
|
|
64
107
|
|
|
65
108
|
---
|
|
66
109
|
|
|
67
|
-
|
|
110
|
+
### 5. Vite Project Initialization
|
|
111
|
+
|
|
112
|
+
**Action:** Create the project with Vite in the current directory
|
|
113
|
+
|
|
114
|
+
**Commands to execute:**
|
|
68
115
|
|
|
69
116
|
```bash
|
|
70
|
-
#
|
|
71
|
-
|
|
117
|
+
# Return to project directory
|
|
118
|
+
cd <project_dir>
|
|
119
|
+
|
|
120
|
+
# If TypeScript
|
|
121
|
+
npm create vite@latest . -- --template react-ts
|
|
72
122
|
|
|
73
|
-
#
|
|
74
|
-
npm create vite@latest
|
|
123
|
+
# If JavaScript
|
|
124
|
+
npm create vite@latest . -- --template react
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
---
|
|
128
|
+
|
|
129
|
+
### 6. Project Structure Verification
|
|
75
130
|
|
|
76
|
-
|
|
131
|
+
**Action:** Verify the project structure is correct
|
|
132
|
+
|
|
133
|
+
**Commands to execute:**
|
|
134
|
+
|
|
135
|
+
```bash
|
|
136
|
+
ls -la
|
|
77
137
|
```
|
|
78
138
|
|
|
139
|
+
**Verification checklist:**
|
|
140
|
+
|
|
141
|
+
1. **package.json** must be at the root of the current directory
|
|
142
|
+
2. **src/** folder must be present
|
|
143
|
+
3. **public/** folder must be present
|
|
144
|
+
4. **The reactive-json and reactive-json-docs repositories must NOT be in this directory** (they should only be in the workspace)
|
|
145
|
+
|
|
146
|
+
**Instructions:**
|
|
147
|
+
|
|
148
|
+
> **IMPORTANT: Project Structure Verification**
|
|
149
|
+
>
|
|
150
|
+
> Please verify the following:
|
|
151
|
+
>
|
|
152
|
+
> ✅ `package.json` is at the root of your current directory
|
|
153
|
+
> ✅ `src/` and `public/` folders are present
|
|
154
|
+
> ✅ `reactive-json/` and `reactive-json-docs/` folders are NOT in this directory
|
|
155
|
+
>
|
|
156
|
+
> If any of these conditions are not met, **STOP** and resolve the issues before continuing.
|
|
157
|
+
|
|
79
158
|
---
|
|
80
159
|
|
|
81
|
-
|
|
160
|
+
### 7. Dependencies Installation
|
|
161
|
+
|
|
162
|
+
**Action:** Install required packages
|
|
163
|
+
|
|
164
|
+
**Commands to execute:**
|
|
82
165
|
|
|
83
166
|
```bash
|
|
84
167
|
npm install
|
|
@@ -87,14 +170,21 @@ npm install @ea-lab/reactive-json bootstrap react-bootstrap axios clsx dnd-kit-s
|
|
|
87
170
|
|
|
88
171
|
---
|
|
89
172
|
|
|
90
|
-
|
|
173
|
+
### 8. Cursor Project Rules Creation
|
|
174
|
+
|
|
175
|
+
**Action:** Copy Cursor rules from documentation repositories
|
|
91
176
|
|
|
92
|
-
|
|
177
|
+
**IMPORTANT:** This step must be done **immediately after installing dependencies** so that Cursor applies the rules during all subsequent code modifications.
|
|
93
178
|
|
|
179
|
+
**Instructions:**
|
|
180
|
+
|
|
181
|
+
1. Create the `.cursor/rules/` folder in your project:
|
|
94
182
|
```bash
|
|
95
|
-
# Create rules directory
|
|
96
183
|
mkdir -p .cursor/rules
|
|
184
|
+
```
|
|
97
185
|
|
|
186
|
+
2. Copy and merge rules from documentation repositories:
|
|
187
|
+
```bash
|
|
98
188
|
# Copy rules from reactive-json
|
|
99
189
|
cp -r <docs_location>/reactive-json/.cursor/rules/* .cursor/rules/
|
|
100
190
|
|
|
@@ -110,21 +200,25 @@ These rules contain all the necessary directives to work effectively with reacti
|
|
|
110
200
|
|
|
111
201
|
---
|
|
112
202
|
|
|
113
|
-
|
|
203
|
+
### 9. Generated Project Cleanup
|
|
114
204
|
|
|
115
|
-
Remove
|
|
205
|
+
**Action:** Remove/clean files generated by Vite
|
|
116
206
|
|
|
207
|
+
**Files to delete:**
|
|
117
208
|
- `src/App.css`
|
|
118
209
|
- `src/index.css` (keep only base styles)
|
|
119
210
|
- `public/vite.svg`
|
|
120
211
|
- `src/assets/react.svg`
|
|
121
212
|
|
|
122
|
-
|
|
213
|
+
**Files to modify:**
|
|
214
|
+
|
|
215
|
+
**`src/main.tsx` (or `src/main.jsx`):**
|
|
123
216
|
|
|
124
|
-
```
|
|
217
|
+
```javascript
|
|
125
218
|
import React from 'react'
|
|
126
219
|
import ReactDOM from 'react-dom/client'
|
|
127
220
|
import App from './App.tsx'
|
|
221
|
+
// Import Bootstrap styles for reactive-json
|
|
128
222
|
import 'bootstrap/dist/css/bootstrap.min.css'
|
|
129
223
|
|
|
130
224
|
ReactDOM.createRoot(document.getElementById('root')!).render(
|
|
@@ -136,11 +230,15 @@ ReactDOM.createRoot(document.getElementById('root')!).render(
|
|
|
136
230
|
|
|
137
231
|
---
|
|
138
232
|
|
|
139
|
-
|
|
233
|
+
### 10. Basic Configuration with ReactiveJsonRoot
|
|
234
|
+
|
|
235
|
+
**Action:** Configure the base component with an external YAML file
|
|
236
|
+
|
|
237
|
+
**IMPORTANT:** Always use an external YAML file for configuration. Never pass configuration directly in props.
|
|
140
238
|
|
|
141
|
-
`src/App.
|
|
239
|
+
**`src/App.tsx` (or `src/App.jsx`):**
|
|
142
240
|
|
|
143
|
-
```
|
|
241
|
+
```javascript
|
|
144
242
|
import { ReactiveJsonRoot } from '@ea-lab/reactive-json'
|
|
145
243
|
import 'bootstrap/dist/css/bootstrap.min.css'
|
|
146
244
|
|
|
@@ -151,7 +249,7 @@ function App() {
|
|
|
151
249
|
export default App
|
|
152
250
|
```
|
|
153
251
|
|
|
154
|
-
|
|
252
|
+
**`public/config.yaml`:**
|
|
155
253
|
|
|
156
254
|
```yaml
|
|
157
255
|
renderView:
|
|
@@ -161,10 +259,142 @@ renderView:
|
|
|
161
259
|
|
|
162
260
|
---
|
|
163
261
|
|
|
164
|
-
|
|
262
|
+
### 11. Routing Configuration (Optional)
|
|
263
|
+
|
|
264
|
+
**Action:** Ask the user if they want to add routing for application organization
|
|
265
|
+
|
|
266
|
+
**Question to ask:**
|
|
267
|
+
|
|
268
|
+
> **Optional: React Router Setup**
|
|
269
|
+
>
|
|
270
|
+
> Do you want to add React Router (react-router-dom) to organize your application with multiple pages/routes?
|
|
271
|
+
>
|
|
272
|
+
> This is useful if you plan to create a multi-page application.
|
|
273
|
+
>
|
|
274
|
+
> **Answer: Yes/No**
|
|
275
|
+
|
|
276
|
+
**If YES, execute the following:**
|
|
277
|
+
|
|
278
|
+
**Install react-router-dom:**
|
|
279
|
+
```bash
|
|
280
|
+
npm install react-router-dom
|
|
281
|
+
# If TypeScript
|
|
282
|
+
npm install --save-dev @types/react-router-dom
|
|
283
|
+
```
|
|
284
|
+
|
|
285
|
+
**Create routing structure:**
|
|
286
|
+
|
|
287
|
+
**`src/components/Navigation.tsx` (or `.jsx`):**
|
|
288
|
+
```javascript
|
|
289
|
+
import { Link, useLocation } from 'react-router-dom'
|
|
290
|
+
|
|
291
|
+
export default function Navigation() {
|
|
292
|
+
const location = useLocation()
|
|
293
|
+
|
|
294
|
+
const navItems = [
|
|
295
|
+
{ path: '/', label: 'Home' },
|
|
296
|
+
// Add or remove items here according to your needs
|
|
297
|
+
]
|
|
298
|
+
|
|
299
|
+
return (
|
|
300
|
+
<nav className="navbar navbar-expand-lg navbar-light bg-light mb-4">
|
|
301
|
+
<div className="container">
|
|
302
|
+
<Link className="navbar-brand" to="/">
|
|
303
|
+
My App
|
|
304
|
+
</Link>
|
|
305
|
+
|
|
306
|
+
<div className="navbar-nav">
|
|
307
|
+
{navItems.map((item) => (
|
|
308
|
+
<Link
|
|
309
|
+
key={item.path}
|
|
310
|
+
className={`nav-link ${location.pathname === item.path ? 'active' : ''}`}
|
|
311
|
+
to={item.path}
|
|
312
|
+
>
|
|
313
|
+
{item.label}
|
|
314
|
+
</Link>
|
|
315
|
+
))}
|
|
316
|
+
</div>
|
|
317
|
+
</div>
|
|
318
|
+
</nav>
|
|
319
|
+
)
|
|
320
|
+
}
|
|
321
|
+
```
|
|
322
|
+
|
|
323
|
+
**`src/config/routes.ts` (or `.js`):**
|
|
324
|
+
```javascript
|
|
325
|
+
export const routeMapping = [
|
|
326
|
+
{ path: '/', rjbuild: '/pages/home.yaml' },
|
|
327
|
+
// Add or remove routes here according to your needs
|
|
328
|
+
// Example: { path: '/about', rjbuild: '/pages/about.yaml' }
|
|
329
|
+
]
|
|
330
|
+
```
|
|
331
|
+
|
|
332
|
+
**Update `src/App.tsx` (or `.jsx`):**
|
|
333
|
+
```javascript
|
|
334
|
+
import { BrowserRouter as Router, Routes, Route } from 'react-router-dom'
|
|
335
|
+
import { ReactiveJsonRoot } from '@ea-lab/reactive-json'
|
|
336
|
+
import { routeMapping } from './config/routes'
|
|
337
|
+
import Navigation from './components/Navigation'
|
|
338
|
+
import 'bootstrap/dist/css/bootstrap.min.css'
|
|
339
|
+
|
|
340
|
+
function App() {
|
|
341
|
+
return (
|
|
342
|
+
<Router>
|
|
343
|
+
<div>
|
|
344
|
+
<Navigation />
|
|
345
|
+
<div className="container">
|
|
346
|
+
<Routes>
|
|
347
|
+
{routeMapping.map((route) => (
|
|
348
|
+
<Route
|
|
349
|
+
key={route.path}
|
|
350
|
+
path={route.path}
|
|
351
|
+
element={
|
|
352
|
+
<ReactiveJsonRoot
|
|
353
|
+
dataUrl={route.rjbuild}
|
|
354
|
+
dataFetchMethod="GET"
|
|
355
|
+
/>
|
|
356
|
+
}
|
|
357
|
+
/>
|
|
358
|
+
))}
|
|
359
|
+
</Routes>
|
|
360
|
+
</div>
|
|
361
|
+
</div>
|
|
362
|
+
</Router>
|
|
363
|
+
)
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
export default App
|
|
367
|
+
```
|
|
368
|
+
|
|
369
|
+
**Create page configuration:**
|
|
370
|
+
```bash
|
|
371
|
+
mkdir -p public/pages
|
|
372
|
+
mkdir -p src/config
|
|
373
|
+
```
|
|
374
|
+
|
|
375
|
+
**`public/pages/home.yaml`:**
|
|
376
|
+
```yaml
|
|
377
|
+
renderView:
|
|
378
|
+
- type: h1
|
|
379
|
+
content: "Welcome to your React + Reactive-JSON app!"
|
|
380
|
+
- type: p
|
|
381
|
+
content: "Your routing is now configured with a navigation bar. You can add more pages in src/pages/ and routes in the App component."
|
|
382
|
+
```
|
|
383
|
+
|
|
384
|
+
**If NO, keep the simple configuration from step 10.**
|
|
385
|
+
|
|
386
|
+
---
|
|
387
|
+
|
|
388
|
+
### 12. Final Verification
|
|
389
|
+
|
|
390
|
+
**Action:** Launch development server
|
|
165
391
|
|
|
166
392
|
```bash
|
|
167
393
|
npm run dev
|
|
168
394
|
```
|
|
169
395
|
|
|
170
|
-
If the
|
|
396
|
+
If the server starts without errors and you see the expected message in your browser, the installation is successful. You can start developing your application with reactive-json.
|
|
397
|
+
|
|
398
|
+
**Expected results:**
|
|
399
|
+
- **Without routing:** "Ready to start!" message
|
|
400
|
+
- **With routing:** "Welcome to your React + Reactive-JSON app!" message with a navigation bar at the top of the page allowing navigation between pages
|
|
@@ -7,48 +7,82 @@ renderView:
|
|
|
7
7
|
value: |
|
|
8
8
|
# Initialization Prompt - Vite + React + @ea-lab/reactive-json Project
|
|
9
9
|
|
|
10
|
-
## ⚠️ Important
|
|
10
|
+
## ⚠️ Important Rules
|
|
11
11
|
|
|
12
12
|
**NEVER SKIP STEPS** unless explicitly requested by the user. Each step is critical for the proper functioning of the project and must be executed in the defined chronological order.
|
|
13
13
|
|
|
14
|
+
When user feedback is required, wait for it and do not continue until this feedback is given.
|
|
15
|
+
|
|
14
16
|
Adapt commands according to the execution environment (Windows, Ubuntu, Mac...).
|
|
15
17
|
|
|
16
18
|
## Table of Contents
|
|
17
19
|
|
|
18
|
-
1. [
|
|
19
|
-
2. [
|
|
20
|
-
3. [
|
|
21
|
-
4. [
|
|
22
|
-
5. [
|
|
23
|
-
6. [
|
|
24
|
-
7. [
|
|
25
|
-
8. [
|
|
26
|
-
9. [
|
|
27
|
-
|
|
28
|
-
|
|
20
|
+
1. [Project Directory Confirmation](#1-project-directory-confirmation)
|
|
21
|
+
2. [Collecting User Information](#2-collecting-user-information)
|
|
22
|
+
3. [Documentation Repositories Setup](#3-documentation-repositories-setup)
|
|
23
|
+
4. [Cursor Workspace Configuration](#4-cursor-workspace-configuration)
|
|
24
|
+
5. [Vite Project Initialization](#5-vite-project-initialization)
|
|
25
|
+
6. [Project Structure Verification](#6-project-structure-verification)
|
|
26
|
+
7. [Dependencies Installation](#7-dependencies-installation)
|
|
27
|
+
8. [Cursor Project Rules Creation](#8-cursor-project-rules-creation)
|
|
28
|
+
9. [Generated Project Cleanup](#9-generated-project-cleanup)
|
|
29
|
+
10. [Basic Configuration with ReactiveJsonRoot](#10-basic-configuration-with-reactivejsonroot)
|
|
30
|
+
11. [Routing Configuration (Optional)](#11-routing-configuration-optional)
|
|
31
|
+
12. [Final Verification](#12-final-verification)
|
|
29
32
|
|
|
30
33
|
## Chronological Steps
|
|
31
34
|
|
|
32
|
-
### 1.
|
|
35
|
+
### 1. Project Directory Confirmation
|
|
36
|
+
|
|
37
|
+
**Action:** Show the user if the IDE is opened in the directory where the project will
|
|
38
|
+
be initialized, then ask for confirmation:
|
|
39
|
+
|
|
40
|
+
- Execute the command:
|
|
41
|
+
```bash
|
|
42
|
+
pwd
|
|
43
|
+
```
|
|
44
|
+
- Show the user this info:
|
|
45
|
+
> **IMPORTANT: Directory Confirmation Required**
|
|
46
|
+
>
|
|
47
|
+
> **Current directory:** `[Display the result of pwd command]`
|
|
48
|
+
>
|
|
49
|
+
> **This directory will become your project root.** All project files will be created here.
|
|
50
|
+
- Ask the user for confirmation:
|
|
51
|
+
> **Do you confirm that this is the correct location before continuing?** If the location is wrong,
|
|
52
|
+
> please open in your IDE the location where the project will be created and restart the
|
|
53
|
+
> installation procedure.
|
|
54
|
+
- User feedback required.
|
|
55
|
+
- When user confirms, note the project directory as `<project_dir>` and go to the next step.
|
|
56
|
+
|
|
57
|
+
---
|
|
58
|
+
|
|
59
|
+
### 2. Collecting User Information
|
|
33
60
|
|
|
34
61
|
**Action:** Ask the user for the following information:
|
|
35
62
|
|
|
36
|
-
- **Project name**: Will be used to create the project folder
|
|
37
63
|
- **TypeScript**: Ask if the user wants to use TypeScript (yes/no)
|
|
38
|
-
- **Documentation repositories location**: Absolute path where to clone reactive-json and reactive-json-docs repositories
|
|
64
|
+
- **Documentation repositories location**: Absolute path where to clone reactive-json and reactive-json-docs repositories. When the user gives a relative path, convert it to absolute
|
|
65
|
+
and ask for confirmation.
|
|
66
|
+
|
|
67
|
+
**Important:** For documentation location, **NEVER** place them in the current project directory. Propose by default: `~/cursor-docs/` or let the user specify another location outside the current project.
|
|
39
68
|
|
|
40
69
|
**Variables to remember:**
|
|
41
|
-
- `<project_name>`: The name provided by the user
|
|
42
70
|
- `<use_typescript>`: true/false based on the answer
|
|
43
|
-
- `<docs_location>`: Absolute path for repositories
|
|
71
|
+
- `<docs_location>`: Absolute path for repositories (must be outside current directory)
|
|
44
72
|
|
|
45
|
-
|
|
73
|
+
**Validation:** Verify that `<docs_location>` is not within the current project directory.
|
|
74
|
+
When invalid, ask again the location with valid suggestions.
|
|
75
|
+
|
|
76
|
+
---
|
|
77
|
+
|
|
78
|
+
### 3. Documentation Repositories Setup
|
|
46
79
|
|
|
47
80
|
**Action:** Clone the required documentation repositories
|
|
48
81
|
|
|
49
82
|
**Commands to execute:**
|
|
50
83
|
|
|
51
84
|
```bash
|
|
85
|
+
mkdir -p <docs_location>
|
|
52
86
|
cd <docs_location>
|
|
53
87
|
git clone https://github.com/Ealab-collab/reactive-json.git
|
|
54
88
|
git clone https://github.com/Ealab-collab/reactive-json-docs.git
|
|
@@ -56,9 +90,11 @@ renderView:
|
|
|
56
90
|
|
|
57
91
|
**Important:** Explain to the user that these repositories are **only** for Cursor to index the documentation and will **not** be included in the final project.
|
|
58
92
|
|
|
59
|
-
**Note:** If the user indicates that the repositories are already cloned, proceed directly to step
|
|
93
|
+
**Note:** If the user indicates that the repositories are already cloned, proceed directly to step 4 (Cursor Workspace Configuration) as it is essential to add the folders to the workspace even if they already exist.
|
|
60
94
|
|
|
61
|
-
|
|
95
|
+
---
|
|
96
|
+
|
|
97
|
+
### 4. Cursor Workspace Configuration
|
|
62
98
|
|
|
63
99
|
**Action:** Ask the user to add repositories to the workspace
|
|
64
100
|
|
|
@@ -74,25 +110,59 @@ renderView:
|
|
|
74
110
|
>
|
|
75
111
|
> **Confirm that this step is completed before continuing.**
|
|
76
112
|
|
|
77
|
-
|
|
113
|
+
---
|
|
114
|
+
|
|
115
|
+
### 5. Vite Project Initialization
|
|
78
116
|
|
|
79
|
-
**Action:** Create the project with Vite
|
|
117
|
+
**Action:** Create the project with Vite in the current directory
|
|
80
118
|
|
|
81
119
|
**Commands to execute:**
|
|
82
120
|
|
|
83
121
|
```bash
|
|
122
|
+
# Return to project directory
|
|
123
|
+
cd <project_dir>
|
|
124
|
+
|
|
84
125
|
# If TypeScript
|
|
85
|
-
npm create vite@latest
|
|
126
|
+
npm create vite@latest . -- --template react-ts
|
|
86
127
|
|
|
87
128
|
# If JavaScript
|
|
88
|
-
npm create vite@latest
|
|
129
|
+
npm create vite@latest . -- --template react
|
|
89
130
|
```
|
|
90
131
|
|
|
132
|
+
---
|
|
133
|
+
|
|
134
|
+
### 6. Project Structure Verification
|
|
135
|
+
|
|
136
|
+
**Action:** Verify the project structure is correct
|
|
137
|
+
|
|
138
|
+
**Commands to execute:**
|
|
139
|
+
|
|
91
140
|
```bash
|
|
92
|
-
|
|
141
|
+
ls -la
|
|
93
142
|
```
|
|
94
143
|
|
|
95
|
-
|
|
144
|
+
**Verification checklist:**
|
|
145
|
+
|
|
146
|
+
1. **package.json** must be at the root of the current directory
|
|
147
|
+
2. **src/** folder must be present
|
|
148
|
+
3. **public/** folder must be present
|
|
149
|
+
4. **The reactive-json and reactive-json-docs repositories must NOT be in this directory** (they should only be in the workspace)
|
|
150
|
+
|
|
151
|
+
**Instructions:**
|
|
152
|
+
|
|
153
|
+
> **IMPORTANT: Project Structure Verification**
|
|
154
|
+
>
|
|
155
|
+
> Please verify the following:
|
|
156
|
+
>
|
|
157
|
+
> ✅ `package.json` is at the root of your current directory
|
|
158
|
+
> ✅ `src/` and `public/` folders are present
|
|
159
|
+
> ✅ `reactive-json/` and `reactive-json-docs/` folders are NOT in this directory
|
|
160
|
+
>
|
|
161
|
+
> If any of these conditions are not met, **STOP** and resolve the issues before continuing.
|
|
162
|
+
|
|
163
|
+
---
|
|
164
|
+
|
|
165
|
+
### 7. Dependencies Installation
|
|
96
166
|
|
|
97
167
|
**Action:** Install required packages
|
|
98
168
|
|
|
@@ -103,7 +173,9 @@ renderView:
|
|
|
103
173
|
npm install @ea-lab/reactive-json bootstrap react-bootstrap axios clsx dnd-kit-sortable-tree html-react-parser js-yaml jsonpath lodash
|
|
104
174
|
```
|
|
105
175
|
|
|
106
|
-
|
|
176
|
+
---
|
|
177
|
+
|
|
178
|
+
### 8. Cursor Project Rules Creation
|
|
107
179
|
|
|
108
180
|
**Action:** Copy Cursor rules from documentation repositories
|
|
109
181
|
|
|
@@ -131,7 +203,9 @@ renderView:
|
|
|
131
203
|
- Code language rules
|
|
132
204
|
- And other project-specific rules
|
|
133
205
|
|
|
134
|
-
|
|
206
|
+
---
|
|
207
|
+
|
|
208
|
+
### 9. Generated Project Cleanup
|
|
135
209
|
|
|
136
210
|
**Action:** Remove/clean files generated by Vite
|
|
137
211
|
|
|
@@ -145,7 +219,7 @@ renderView:
|
|
|
145
219
|
|
|
146
220
|
**`src/main.tsx` (or `src/main.jsx`):**
|
|
147
221
|
|
|
148
|
-
```
|
|
222
|
+
```javascript
|
|
149
223
|
import React from 'react'
|
|
150
224
|
import ReactDOM from 'react-dom/client'
|
|
151
225
|
import App from './App.tsx'
|
|
@@ -157,9 +231,11 @@ renderView:
|
|
|
157
231
|
)
|
|
158
232
|
```
|
|
159
233
|
|
|
160
|
-
**IMPORTANT**: do not use
|
|
234
|
+
**IMPORTANT**: do not use <StrictMode>. Reactive-JSON doesn't work with it for now!
|
|
161
235
|
|
|
162
|
-
|
|
236
|
+
---
|
|
237
|
+
|
|
238
|
+
### 10. Basic Configuration with ReactiveJsonRoot
|
|
163
239
|
|
|
164
240
|
**Action:** Configure the base component with an external YAML file
|
|
165
241
|
|
|
@@ -167,7 +243,7 @@ renderView:
|
|
|
167
243
|
|
|
168
244
|
**`src/App.tsx` (or `src/App.jsx`):**
|
|
169
245
|
|
|
170
|
-
```
|
|
246
|
+
```javascript
|
|
171
247
|
import { ReactiveJsonRoot } from '@ea-lab/reactive-json'
|
|
172
248
|
import 'bootstrap/dist/css/bootstrap.min.css'
|
|
173
249
|
|
|
@@ -186,7 +262,135 @@ renderView:
|
|
|
186
262
|
content: "Ready to start!"
|
|
187
263
|
```
|
|
188
264
|
|
|
189
|
-
|
|
265
|
+
---
|
|
266
|
+
|
|
267
|
+
### 11. Routing Configuration (Optional)
|
|
268
|
+
|
|
269
|
+
**Action:** Ask the user if they want to add routing for application organization
|
|
270
|
+
|
|
271
|
+
**Question to ask:**
|
|
272
|
+
|
|
273
|
+
> **Optional: React Router Setup**
|
|
274
|
+
>
|
|
275
|
+
> Do you want to add React Router (react-router-dom) to organize your application with multiple pages/routes?
|
|
276
|
+
>
|
|
277
|
+
> This is useful if you plan to create a multi-page application.
|
|
278
|
+
>
|
|
279
|
+
> **Answer: Yes/No**
|
|
280
|
+
|
|
281
|
+
**If YES, execute the following:**
|
|
282
|
+
|
|
283
|
+
**Install react-router-dom:**
|
|
284
|
+
```bash
|
|
285
|
+
npm install react-router-dom
|
|
286
|
+
# If TypeScript
|
|
287
|
+
npm install --save-dev @types/react-router-dom
|
|
288
|
+
```
|
|
289
|
+
|
|
290
|
+
**Create routing structure:**
|
|
291
|
+
|
|
292
|
+
**`src/components/Navigation.tsx` (or `.jsx`):**
|
|
293
|
+
```javascript
|
|
294
|
+
import { Link, useLocation } from 'react-router-dom'
|
|
295
|
+
|
|
296
|
+
export default function Navigation() {
|
|
297
|
+
const location = useLocation()
|
|
298
|
+
|
|
299
|
+
const navItems = [
|
|
300
|
+
{ path: '/', label: 'Home' },
|
|
301
|
+
// Add or remove items here according to your needs
|
|
302
|
+
]
|
|
303
|
+
|
|
304
|
+
return (
|
|
305
|
+
<nav className="navbar navbar-expand-lg navbar-light bg-light mb-4">
|
|
306
|
+
<div className="container">
|
|
307
|
+
<Link className="navbar-brand" to="/">
|
|
308
|
+
My App
|
|
309
|
+
</Link>
|
|
310
|
+
|
|
311
|
+
<div className="navbar-nav">
|
|
312
|
+
{navItems.map((item) => (
|
|
313
|
+
<Link
|
|
314
|
+
key={item.path}
|
|
315
|
+
className={`nav-link ${location.pathname === item.path ? 'active' : ''}`}
|
|
316
|
+
to={item.path}
|
|
317
|
+
>
|
|
318
|
+
{item.label}
|
|
319
|
+
</Link>
|
|
320
|
+
))}
|
|
321
|
+
</div>
|
|
322
|
+
</div>
|
|
323
|
+
</nav>
|
|
324
|
+
)
|
|
325
|
+
}
|
|
326
|
+
```
|
|
327
|
+
|
|
328
|
+
**`src/config/routes.ts` (or `.js`):**
|
|
329
|
+
```javascript
|
|
330
|
+
export const routeMapping = [
|
|
331
|
+
{ path: '/', rjbuild: '/pages/home.yaml' },
|
|
332
|
+
// Add or remove routes here according to your needs
|
|
333
|
+
// Example: { path: '/about', rjbuild: '/pages/about.yaml' }
|
|
334
|
+
]
|
|
335
|
+
```
|
|
336
|
+
|
|
337
|
+
**Update `src/App.tsx` (or `.jsx`):**
|
|
338
|
+
```javascript
|
|
339
|
+
import { BrowserRouter as Router, Routes, Route } from 'react-router-dom'
|
|
340
|
+
import { ReactiveJsonRoot } from '@ea-lab/reactive-json'
|
|
341
|
+
import { routeMapping } from './config/routes'
|
|
342
|
+
import Navigation from './components/Navigation'
|
|
343
|
+
import 'bootstrap/dist/css/bootstrap.min.css'
|
|
344
|
+
|
|
345
|
+
function App() {
|
|
346
|
+
return (
|
|
347
|
+
<Router>
|
|
348
|
+
<div>
|
|
349
|
+
<Navigation />
|
|
350
|
+
<div className="container">
|
|
351
|
+
<Routes>
|
|
352
|
+
{routeMapping.map((route) => (
|
|
353
|
+
<Route
|
|
354
|
+
key={route.path}
|
|
355
|
+
path={route.path}
|
|
356
|
+
element={
|
|
357
|
+
<ReactiveJsonRoot
|
|
358
|
+
dataUrl={route.rjbuild}
|
|
359
|
+
dataFetchMethod="GET"
|
|
360
|
+
/>
|
|
361
|
+
}
|
|
362
|
+
/>
|
|
363
|
+
))}
|
|
364
|
+
</Routes>
|
|
365
|
+
</div>
|
|
366
|
+
</div>
|
|
367
|
+
</Router>
|
|
368
|
+
)
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
export default App
|
|
372
|
+
```
|
|
373
|
+
|
|
374
|
+
**Create page configuration:**
|
|
375
|
+
```bash
|
|
376
|
+
mkdir -p public/pages
|
|
377
|
+
mkdir -p src/config
|
|
378
|
+
```
|
|
379
|
+
|
|
380
|
+
**`public/pages/home.yaml`:**
|
|
381
|
+
```yaml
|
|
382
|
+
renderView:
|
|
383
|
+
- type: h1
|
|
384
|
+
content: "Welcome to your React + Reactive-JSON app!"
|
|
385
|
+
- type: p
|
|
386
|
+
content: "Your routing is now configured with a navigation bar. You can add more pages in src/pages/ and routes in the App component."
|
|
387
|
+
```
|
|
388
|
+
|
|
389
|
+
**If NO, keep the simple configuration from step 10.**
|
|
390
|
+
|
|
391
|
+
---
|
|
392
|
+
|
|
393
|
+
### 12. Final Verification
|
|
190
394
|
|
|
191
395
|
**Action:** Launch development server
|
|
192
396
|
|
|
@@ -194,94 +398,244 @@ renderView:
|
|
|
194
398
|
npm run dev
|
|
195
399
|
```
|
|
196
400
|
|
|
197
|
-
If the server starts without errors and you see the
|
|
401
|
+
If the server starts without errors and you see the expected message in your browser, the installation is successful. You can start developing your application with reactive-json.
|
|
402
|
+
|
|
403
|
+
**Expected results:**
|
|
404
|
+
- **Without routing:** "Ready to start!" message
|
|
405
|
+
- **With routing:** "Welcome to your React + Reactive-JSON app!" message with a navigation bar at the top of the page allowing navigation between pages
|
|
198
406
|
- type: Markdown
|
|
199
407
|
content: |
|
|
200
|
-
# Reactive-JSON Installation Guide
|
|
408
|
+
# Reactive-JSON Installation Guide
|
|
201
409
|
|
|
202
|
-
|
|
410
|
+
This guide walks you through setting up a new Vite + React project with `@ea-lab/reactive-json`. Follow each step carefully to ensure a successful installation.
|
|
203
411
|
|
|
204
|
-
>
|
|
412
|
+
> **💡 Pro Tip**: Use the **Copy initialization prompt** button above to get an AI-assisted step-by-step installation process in Cursor IDE.
|
|
205
413
|
|
|
206
|
-
##
|
|
414
|
+
## Prerequisites
|
|
207
415
|
|
|
208
|
-
|
|
416
|
+
- **Node.js** (version 16 or higher)
|
|
417
|
+
- **npm** or **yarn** package manager
|
|
418
|
+
- **Git** for cloning repositories
|
|
419
|
+
- **Cursor IDE** (recommended) or any code editor
|
|
420
|
+
|
|
421
|
+
## Quick Start
|
|
422
|
+
|
|
423
|
+
1. [Project Setup](#project-setup)
|
|
424
|
+
2. [Documentation Setup](#documentation-setup)
|
|
425
|
+
3. [Vite Project Creation](#vite-project-creation)
|
|
426
|
+
4. [Dependencies Installation](#dependencies-installation)
|
|
427
|
+
5. [Configuration](#configuration)
|
|
428
|
+
6. [Optional Routing](#optional-routing)
|
|
429
|
+
7. [Verification](#verification)
|
|
430
|
+
|
|
431
|
+
---
|
|
432
|
+
|
|
433
|
+
- type: h2
|
|
434
|
+
content: "Project Setup"
|
|
435
|
+
attributes:
|
|
436
|
+
id: "project-setup"
|
|
437
|
+
|
|
438
|
+
- type: Markdown
|
|
439
|
+
content: |
|
|
440
|
+
### Step 1: Verify Project Directory
|
|
209
441
|
|
|
210
|
-
|
|
211
|
-
Ask the following questions:
|
|
212
|
-
1. **Project name** (`<project_name>`)
|
|
213
|
-
2. **Use TypeScript?** (`<use_typescript>`)
|
|
214
|
-
3. **Absolute path for documentation repositories** (`<docs_location>`)
|
|
442
|
+
First, ensure you're in the correct directory where your project will be created.
|
|
215
443
|
|
|
216
|
-
### 2. Documentation Repositories Setup
|
|
217
|
-
Execute the following commands:
|
|
218
444
|
- type: SyntaxHighlighter
|
|
219
445
|
language: bash
|
|
220
446
|
content: |
|
|
221
|
-
|
|
447
|
+
pwd
|
|
448
|
+
|
|
449
|
+
- type: Markdown
|
|
450
|
+
content: |
|
|
451
|
+
**Verify that:**
|
|
452
|
+
- You're in the intended project directory
|
|
453
|
+
- The directory is empty or contains only files you want to keep
|
|
454
|
+
- You have write permissions
|
|
455
|
+
|
|
456
|
+
> **⚠️ Important**: This directory will become your project root. All project files will be created here.
|
|
457
|
+
|
|
458
|
+
### Step 2: Choose Your Setup
|
|
459
|
+
|
|
460
|
+
Decide on your project configuration:
|
|
461
|
+
|
|
462
|
+
- **TypeScript**: Do you want to use TypeScript? (Recommended for better development experience)
|
|
463
|
+
- **Documentation location**: Choose where to store documentation repositories (outside your project directory)
|
|
464
|
+
|
|
465
|
+
**Recommended documentation location**: `~/cursor-docs/`
|
|
466
|
+
|
|
467
|
+
---
|
|
468
|
+
|
|
469
|
+
- type: h2
|
|
470
|
+
content: "Documentation Setup"
|
|
471
|
+
attributes:
|
|
472
|
+
id: "documentation-setup"
|
|
473
|
+
|
|
474
|
+
- type: Markdown
|
|
475
|
+
content: |
|
|
476
|
+
### Step 3: Clone Documentation Repositories
|
|
477
|
+
|
|
478
|
+
Clone the required documentation repositories for Cursor IDE integration:
|
|
479
|
+
|
|
480
|
+
- type: SyntaxHighlighter
|
|
481
|
+
language: bash
|
|
482
|
+
content: |
|
|
483
|
+
# Create documentation directory
|
|
484
|
+
mkdir -p ~/cursor-docs
|
|
485
|
+
cd ~/cursor-docs
|
|
486
|
+
|
|
487
|
+
# Clone repositories
|
|
222
488
|
git clone https://github.com/Ealab-collab/reactive-json.git
|
|
223
489
|
git clone https://github.com/Ealab-collab/reactive-json-docs.git
|
|
224
490
|
|
|
225
491
|
- type: Markdown
|
|
226
492
|
content: |
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
493
|
+
> **ℹ️ Note**: These repositories are for Cursor IDE documentation indexing only. They won't be included in your final project.
|
|
494
|
+
|
|
495
|
+
### Step 4: Add to Cursor Workspace
|
|
496
|
+
|
|
497
|
+
**Manual Action Required**: Add the cloned folders to your Cursor workspace:
|
|
498
|
+
|
|
499
|
+
1. Open Cursor IDE
|
|
500
|
+
2. Go to `File > Add Folder to Workspace`
|
|
501
|
+
3. Add `~/cursor-docs/reactive-json`
|
|
502
|
+
4. Add `~/cursor-docs/reactive-json-docs`
|
|
503
|
+
|
|
504
|
+
- type: img
|
|
505
|
+
attributes:
|
|
506
|
+
src: "/images/cursor-add-folder-to-workspace.png"
|
|
507
|
+
alt: "Cursor IDE File menu showing 'Add Folder to Workspace' option"
|
|
508
|
+
class: border m-4 rounded shadow-sm
|
|
509
|
+
style:
|
|
510
|
+
maxWidth: "100%"
|
|
511
|
+
height: "auto"
|
|
512
|
+
|
|
513
|
+
- type: Markdown
|
|
514
|
+
content: |
|
|
515
|
+
> **💡 Why this step?**: Cursor needs access to these repositories to provide AI assistance and code completion for Reactive-JSON development.
|
|
516
|
+
|
|
517
|
+
---
|
|
518
|
+
|
|
519
|
+
- type: h2
|
|
520
|
+
content: "Vite Project Creation"
|
|
521
|
+
attributes:
|
|
522
|
+
id: "vite-project-creation"
|
|
523
|
+
|
|
524
|
+
- type: Markdown
|
|
525
|
+
content: |
|
|
526
|
+
### Step 5: Initialize Vite Project
|
|
527
|
+
|
|
528
|
+
Create a new Vite project with React:
|
|
529
|
+
|
|
530
|
+
- type: SyntaxHighlighter
|
|
531
|
+
language: bash
|
|
532
|
+
content: |
|
|
533
|
+
# Return to your project directory
|
|
534
|
+
cd /path/to/your/project
|
|
535
|
+
|
|
536
|
+
# For TypeScript (recommended)
|
|
537
|
+
npm create vite@latest . -- --template react-ts
|
|
538
|
+
|
|
539
|
+
# For JavaScript
|
|
540
|
+
npm create vite@latest . -- --template react
|
|
231
541
|
|
|
232
542
|
- type: Markdown
|
|
233
543
|
content: |
|
|
234
|
-
###
|
|
544
|
+
### Step 6: Verify Project Structure
|
|
545
|
+
|
|
546
|
+
Confirm the project was created correctly:
|
|
547
|
+
|
|
235
548
|
- type: SyntaxHighlighter
|
|
236
549
|
language: bash
|
|
237
550
|
content: |
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
551
|
+
ls -la
|
|
552
|
+
|
|
553
|
+
- type: Markdown
|
|
554
|
+
content: |
|
|
555
|
+
**Expected structure:**
|
|
556
|
+
```
|
|
557
|
+
├── package.json
|
|
558
|
+
├── src/
|
|
559
|
+
├── public/
|
|
560
|
+
├── index.html
|
|
561
|
+
└── vite.config.ts (or .js)
|
|
562
|
+
```
|
|
563
|
+
|
|
564
|
+
> **✅ Verification checklist:**
|
|
565
|
+
> - `package.json` exists at root
|
|
566
|
+
> - `src/` and `public/` folders are present
|
|
567
|
+
> - Documentation repositories are NOT in this directory
|
|
568
|
+
|
|
569
|
+
---
|
|
570
|
+
|
|
571
|
+
- type: h2
|
|
572
|
+
content: "Dependencies Installation"
|
|
573
|
+
attributes:
|
|
574
|
+
id: "dependencies-installation"
|
|
243
575
|
|
|
244
576
|
- type: Markdown
|
|
245
577
|
content: |
|
|
246
|
-
###
|
|
578
|
+
### Step 7: Install Dependencies
|
|
579
|
+
|
|
580
|
+
Install Reactive-JSON and required packages:
|
|
581
|
+
|
|
247
582
|
- type: SyntaxHighlighter
|
|
248
583
|
language: bash
|
|
249
584
|
content: |
|
|
585
|
+
# Install base dependencies
|
|
250
586
|
npm install
|
|
587
|
+
|
|
588
|
+
# Install Reactive-JSON and required packages
|
|
251
589
|
npm install @ea-lab/reactive-json bootstrap react-bootstrap axios clsx dnd-kit-sortable-tree html-react-parser js-yaml jsonpath lodash
|
|
252
590
|
|
|
253
591
|
- type: Markdown
|
|
254
592
|
content: |
|
|
255
|
-
###
|
|
256
|
-
|
|
593
|
+
### Step 8: Setup Cursor Rules
|
|
594
|
+
|
|
595
|
+
Copy Cursor IDE rules for optimal development experience:
|
|
596
|
+
|
|
257
597
|
- type: SyntaxHighlighter
|
|
258
598
|
language: bash
|
|
259
599
|
content: |
|
|
260
600
|
# Create rules directory
|
|
261
601
|
mkdir -p .cursor/rules
|
|
262
602
|
|
|
263
|
-
# Copy rules from
|
|
264
|
-
cp -r
|
|
265
|
-
|
|
266
|
-
# Copy and merge rules from reactive-json-docs
|
|
267
|
-
cp -r <docs_location>/reactive-json-docs/.cursor/rules/* .cursor/rules/
|
|
603
|
+
# Copy rules from documentation repositories
|
|
604
|
+
cp -r ~/cursor-docs/reactive-json/.cursor/rules/* .cursor/rules/
|
|
605
|
+
cp -r ~/cursor-docs/reactive-json-docs/.cursor/rules/* .cursor/rules/
|
|
268
606
|
|
|
269
607
|
- type: Markdown
|
|
270
608
|
content: |
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
609
|
+
> **⚡ Important**: Do this step immediately after installing dependencies. Cursor will apply these rules for all subsequent code modifications.
|
|
610
|
+
|
|
611
|
+
---
|
|
612
|
+
|
|
613
|
+
- type: h2
|
|
614
|
+
content: "Configuration"
|
|
615
|
+
attributes:
|
|
616
|
+
id: "configuration"
|
|
276
617
|
|
|
277
618
|
- type: Markdown
|
|
278
619
|
content: |
|
|
279
|
-
###
|
|
280
|
-
|
|
620
|
+
### Step 9: Clean Up Generated Files
|
|
621
|
+
|
|
622
|
+
Remove unnecessary files created by Vite:
|
|
623
|
+
|
|
624
|
+
- type: SyntaxHighlighter
|
|
625
|
+
language: bash
|
|
626
|
+
content: |
|
|
627
|
+
# Remove unnecessary files
|
|
628
|
+
rm src/App.css
|
|
629
|
+
rm src/index.css
|
|
630
|
+
rm public/vite.svg
|
|
631
|
+
rm src/assets/react.svg
|
|
281
632
|
|
|
282
633
|
- type: Markdown
|
|
283
634
|
content: |
|
|
284
|
-
|
|
635
|
+
### Step 10: Configure Main Entry Point
|
|
636
|
+
|
|
637
|
+
Update `src/main.tsx` (or `src/main.jsx`):
|
|
638
|
+
|
|
285
639
|
- type: SyntaxHighlighter
|
|
286
640
|
language: typescript
|
|
287
641
|
content: |
|
|
@@ -296,13 +650,12 @@ renderView:
|
|
|
296
650
|
|
|
297
651
|
- type: Markdown
|
|
298
652
|
content: |
|
|
299
|
-
|
|
653
|
+
> **⚠️ Important**: Do not use `<StrictMode>`. Reactive-JSON doesn't work with React StrictMode currently.
|
|
300
654
|
|
|
301
|
-
###
|
|
655
|
+
### Step 11: Create Basic App Configuration
|
|
656
|
+
|
|
657
|
+
Update `src/App.tsx` (or `src/App.jsx`):
|
|
302
658
|
|
|
303
|
-
- type: Markdown
|
|
304
|
-
content: |
|
|
305
|
-
**File: src/App.tsx**
|
|
306
659
|
- type: SyntaxHighlighter
|
|
307
660
|
language: typescript
|
|
308
661
|
content: |
|
|
@@ -317,23 +670,211 @@ renderView:
|
|
|
317
670
|
|
|
318
671
|
- type: Markdown
|
|
319
672
|
content: |
|
|
320
|
-
|
|
673
|
+
Create `public/config.yaml`:
|
|
674
|
+
|
|
321
675
|
- type: SyntaxHighlighter
|
|
322
676
|
language: yaml
|
|
323
677
|
content: |
|
|
324
678
|
renderView:
|
|
325
679
|
- type: h1
|
|
326
680
|
content: "Ready to start!"
|
|
681
|
+
- type: p
|
|
682
|
+
content: "Your Reactive-JSON application is now configured and ready for development."
|
|
327
683
|
|
|
328
684
|
- type: Markdown
|
|
329
685
|
content: |
|
|
330
|
-
|
|
686
|
+
---
|
|
687
|
+
|
|
688
|
+
- type: h2
|
|
689
|
+
content: "Optional Routing"
|
|
690
|
+
attributes:
|
|
691
|
+
id: "optional-routing"
|
|
692
|
+
|
|
693
|
+
- type: Markdown
|
|
694
|
+
content: |
|
|
695
|
+
### Step 12: Add React Router (Optional)
|
|
696
|
+
|
|
697
|
+
For multi-page applications, you can add React Router:
|
|
698
|
+
|
|
699
|
+
- type: SyntaxHighlighter
|
|
700
|
+
language: bash
|
|
701
|
+
content: |
|
|
702
|
+
# Install React Router
|
|
703
|
+
npm install react-router-dom
|
|
704
|
+
|
|
705
|
+
# For TypeScript projects
|
|
706
|
+
npm install --save-dev @types/react-router-dom
|
|
707
|
+
|
|
708
|
+
- type: Markdown
|
|
709
|
+
content: |
|
|
710
|
+
**Create navigation component** (`src/components/Navigation.tsx`):
|
|
711
|
+
|
|
712
|
+
- type: SyntaxHighlighter
|
|
713
|
+
language: typescript
|
|
714
|
+
content: |
|
|
715
|
+
import { Link, useLocation } from 'react-router-dom'
|
|
716
|
+
|
|
717
|
+
export default function Navigation() {
|
|
718
|
+
const location = useLocation()
|
|
719
|
+
|
|
720
|
+
const navItems = [
|
|
721
|
+
{ path: '/', label: 'Home' },
|
|
722
|
+
// Add more navigation items as needed
|
|
723
|
+
]
|
|
724
|
+
|
|
725
|
+
return (
|
|
726
|
+
<nav className="navbar navbar-expand-lg navbar-light bg-light mb-4">
|
|
727
|
+
<div className="container">
|
|
728
|
+
<Link className="navbar-brand" to="/">
|
|
729
|
+
My App
|
|
730
|
+
</Link>
|
|
731
|
+
|
|
732
|
+
<div className="navbar-nav">
|
|
733
|
+
{navItems.map((item) => (
|
|
734
|
+
<Link
|
|
735
|
+
key={item.path}
|
|
736
|
+
className={`nav-link ${location.pathname === item.path ? 'active' : ''}`}
|
|
737
|
+
to={item.path}
|
|
738
|
+
>
|
|
739
|
+
{item.label}
|
|
740
|
+
</Link>
|
|
741
|
+
))}
|
|
742
|
+
</div>
|
|
743
|
+
</div>
|
|
744
|
+
</nav>
|
|
745
|
+
)
|
|
746
|
+
}
|
|
747
|
+
|
|
748
|
+
- type: Markdown
|
|
749
|
+
content: |
|
|
750
|
+
**Create routes configuration** (`src/config/routes.ts`):
|
|
751
|
+
|
|
752
|
+
- type: SyntaxHighlighter
|
|
753
|
+
language: typescript
|
|
754
|
+
content: |
|
|
755
|
+
export const routeMapping = [
|
|
756
|
+
{ path: '/', rjbuild: '/pages/home.yaml' },
|
|
757
|
+
// Add more routes as needed
|
|
758
|
+
// Example: { path: '/about', rjbuild: '/pages/about.yaml' }
|
|
759
|
+
]
|
|
760
|
+
|
|
761
|
+
- type: Markdown
|
|
762
|
+
content: |
|
|
763
|
+
**Update App component** (`src/App.tsx`):
|
|
764
|
+
|
|
765
|
+
- type: SyntaxHighlighter
|
|
766
|
+
language: typescript
|
|
767
|
+
content: |
|
|
768
|
+
import { BrowserRouter as Router, Routes, Route } from 'react-router-dom'
|
|
769
|
+
import { ReactiveJsonRoot } from '@ea-lab/reactive-json'
|
|
770
|
+
import { routeMapping } from './config/routes'
|
|
771
|
+
import Navigation from './components/Navigation'
|
|
772
|
+
import 'bootstrap/dist/css/bootstrap.min.css'
|
|
773
|
+
|
|
774
|
+
function App() {
|
|
775
|
+
return (
|
|
776
|
+
<Router>
|
|
777
|
+
<div>
|
|
778
|
+
<Navigation />
|
|
779
|
+
<div className="container">
|
|
780
|
+
<Routes>
|
|
781
|
+
{routeMapping.map((route) => (
|
|
782
|
+
<Route
|
|
783
|
+
key={route.path}
|
|
784
|
+
path={route.path}
|
|
785
|
+
element={
|
|
786
|
+
<ReactiveJsonRoot
|
|
787
|
+
dataUrl={route.rjbuild}
|
|
788
|
+
dataFetchMethod="GET"
|
|
789
|
+
/>
|
|
790
|
+
}
|
|
791
|
+
/>
|
|
792
|
+
))}
|
|
793
|
+
</Routes>
|
|
794
|
+
</div>
|
|
795
|
+
</div>
|
|
796
|
+
</Router>
|
|
797
|
+
)
|
|
798
|
+
}
|
|
799
|
+
|
|
800
|
+
export default App
|
|
801
|
+
|
|
802
|
+
- type: Markdown
|
|
803
|
+
content: |
|
|
804
|
+
**Create page directories and files**:
|
|
805
|
+
|
|
806
|
+
- type: SyntaxHighlighter
|
|
807
|
+
language: bash
|
|
808
|
+
content: |
|
|
809
|
+
mkdir -p public/pages
|
|
810
|
+
mkdir -p src/config
|
|
811
|
+
mkdir -p src/components
|
|
812
|
+
|
|
813
|
+
- type: Markdown
|
|
814
|
+
content: |
|
|
815
|
+
**Create home page** (`public/pages/home.yaml`):
|
|
816
|
+
|
|
817
|
+
- type: SyntaxHighlighter
|
|
818
|
+
language: yaml
|
|
819
|
+
content: |
|
|
820
|
+
renderView:
|
|
821
|
+
- type: h1
|
|
822
|
+
content: "Welcome to your React + Reactive-JSON app!"
|
|
823
|
+
- type: p
|
|
824
|
+
content: "Your routing is now configured with a navigation bar. You can add more pages in public/pages/ and routes in the App component."
|
|
825
|
+
|
|
826
|
+
- type: Markdown
|
|
827
|
+
content: |
|
|
828
|
+
---
|
|
829
|
+
|
|
830
|
+
- type: h2
|
|
831
|
+
content: "Verification"
|
|
832
|
+
attributes:
|
|
833
|
+
id: "verification"
|
|
834
|
+
|
|
835
|
+
- type: Markdown
|
|
836
|
+
content: |
|
|
837
|
+
### Step 13: Start Development Server
|
|
838
|
+
|
|
839
|
+
Launch your development server:
|
|
840
|
+
|
|
331
841
|
- type: SyntaxHighlighter
|
|
332
842
|
language: bash
|
|
333
843
|
content: |
|
|
334
844
|
npm run dev
|
|
335
845
|
|
|
336
|
-
|
|
846
|
+
- type: Markdown
|
|
847
|
+
content: |
|
|
848
|
+
**Expected results:**
|
|
849
|
+
|
|
850
|
+
- **Without routing**: You should see "Ready to start!" message
|
|
851
|
+
- **With routing**: You should see "Welcome to your React + Reactive-JSON app!" with a navigation bar
|
|
852
|
+
|
|
853
|
+
**Troubleshooting:**
|
|
854
|
+
|
|
855
|
+
- If you see errors, check that all dependencies are installed correctly
|
|
856
|
+
- Ensure the `public/config.yaml` file exists
|
|
857
|
+
- Verify that Bootstrap CSS is imported
|
|
858
|
+
- Check browser console for any JavaScript errors
|
|
859
|
+
|
|
860
|
+
---
|
|
861
|
+
|
|
862
|
+
## Next Steps
|
|
863
|
+
|
|
864
|
+
Congratulations! Your Reactive-JSON project is now set up and ready for development.
|
|
865
|
+
|
|
866
|
+
**What you can do next:**
|
|
867
|
+
|
|
868
|
+
- Explore the [Component Documentation](/docs/core/element/) to learn about available components
|
|
869
|
+
- Check out [Examples](/docs/core/example/) for common use cases
|
|
870
|
+
- Read the [Component Development Guide](/docs/extend/component-development/) to create custom components
|
|
871
|
+
- Visit the [Getting Started Guide](/docs/getting-started/) for more detailed information
|
|
872
|
+
|
|
873
|
+
**Need help?**
|
|
874
|
+
|
|
875
|
+
- Check the [Troubleshooting Guide](/docs/troubleshooting/)
|
|
876
|
+
- Join our [Community Discord](https://discord.gg/reactive-json)
|
|
877
|
+
- Open an issue on [GitHub](https://github.com/Ealab-collab/reactive-json/issues)
|
|
337
878
|
|
|
338
879
|
templates:
|
|
339
880
|
|