@ea-lab/reactive-json-docs 0.1.9 → 0.1.11
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 +2 -2
- package/public/rjbuild/docs/chartjs/overview.yaml +1 -1
- package/public/rjbuild/docs/core/element/special/ReactiveJsonSubroot.md +2 -2
- package/public/rjbuild/docs/core/element/special/ReactiveJsonSubroot.yaml +5 -5
- package/public/rjbuild/docs/install.md +282 -52
- package/public/rjbuild/docs/install.yaml +623 -82
|
@@ -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,12 +243,12 @@ 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
|
|
|
174
250
|
function App() {
|
|
175
|
-
return <ReactiveJsonRoot
|
|
251
|
+
return <ReactiveJsonRoot rjBuildUrl="/config.yaml" rjBuildFetchMethod="GET" />
|
|
176
252
|
}
|
|
177
253
|
|
|
178
254
|
export default App
|
|
@@ -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
|
+
rjBuildUrl={route.rjbuild}
|
|
359
|
+
rjBuildFetchMethod="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
|
|
409
|
+
|
|
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.
|
|
411
|
+
|
|
412
|
+
> **💡 Pro Tip**: Use the **Copy initialization prompt** button above to get an AI-assisted step-by-step installation process in Cursor IDE.
|
|
413
|
+
|
|
414
|
+
## Prerequisites
|
|
201
415
|
|
|
202
|
-
|
|
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
|
|
203
420
|
|
|
204
|
-
|
|
421
|
+
## Quick Start
|
|
205
422
|
|
|
206
|
-
|
|
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)
|
|
207
430
|
|
|
208
|
-
|
|
431
|
+
---
|
|
209
432
|
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
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
|
|
441
|
+
|
|
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
|
-
npm create vite@latest <project_name> -- --template react-ts
|
|
240
|
-
# With JavaScript
|
|
241
|
-
npm create vite@latest <project_name> -- --template react
|
|
242
|
-
cd <project_name>
|
|
551
|
+
ls -la
|
|
243
552
|
|
|
244
553
|
- type: Markdown
|
|
245
554
|
content: |
|
|
246
|
-
|
|
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"
|
|
575
|
+
|
|
576
|
+
- type: Markdown
|
|
577
|
+
content: |
|
|
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,44 +650,231 @@ 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.
|
|
654
|
+
|
|
655
|
+
### Step 11: Create Basic App Configuration
|
|
656
|
+
|
|
657
|
+
Update `src/App.tsx` (or `src/App.jsx`):
|
|
658
|
+
|
|
659
|
+
- type: SyntaxHighlighter
|
|
660
|
+
language: typescript
|
|
661
|
+
content: |
|
|
662
|
+
import { ReactiveJsonRoot } from '@ea-lab/reactive-json'
|
|
663
|
+
import 'bootstrap/dist/css/bootstrap.min.css'
|
|
664
|
+
|
|
665
|
+
function App() {
|
|
666
|
+
return <ReactiveJsonRoot rjBuildUrl="/config.yaml" rjBuildFetchMethod="GET" />
|
|
667
|
+
}
|
|
668
|
+
|
|
669
|
+
export default App
|
|
670
|
+
|
|
671
|
+
- type: Markdown
|
|
672
|
+
content: |
|
|
673
|
+
Create `public/config.yaml`:
|
|
674
|
+
|
|
675
|
+
- type: SyntaxHighlighter
|
|
676
|
+
language: yaml
|
|
677
|
+
content: |
|
|
678
|
+
renderView:
|
|
679
|
+
- type: h1
|
|
680
|
+
content: "Ready to start!"
|
|
681
|
+
- type: p
|
|
682
|
+
content: "Your Reactive-JSON application is now configured and ready for development."
|
|
683
|
+
|
|
684
|
+
- type: Markdown
|
|
685
|
+
content: |
|
|
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`):
|
|
300
751
|
|
|
301
|
-
|
|
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
|
+
]
|
|
302
760
|
|
|
303
761
|
- type: Markdown
|
|
304
762
|
content: |
|
|
305
|
-
**
|
|
763
|
+
**Update App component** (`src/App.tsx`):
|
|
764
|
+
|
|
306
765
|
- type: SyntaxHighlighter
|
|
307
766
|
language: typescript
|
|
308
767
|
content: |
|
|
768
|
+
import { BrowserRouter as Router, Routes, Route } from 'react-router-dom'
|
|
309
769
|
import { ReactiveJsonRoot } from '@ea-lab/reactive-json'
|
|
770
|
+
import { routeMapping } from './config/routes'
|
|
771
|
+
import Navigation from './components/Navigation'
|
|
310
772
|
import 'bootstrap/dist/css/bootstrap.min.css'
|
|
311
773
|
|
|
312
774
|
function App() {
|
|
313
|
-
return
|
|
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
|
+
rjBuildUrl={route.rjbuild}
|
|
788
|
+
rjBuildFetchMethod="GET"
|
|
789
|
+
/>
|
|
790
|
+
}
|
|
791
|
+
/>
|
|
792
|
+
))}
|
|
793
|
+
</Routes>
|
|
794
|
+
</div>
|
|
795
|
+
</div>
|
|
796
|
+
</Router>
|
|
797
|
+
)
|
|
314
798
|
}
|
|
315
799
|
|
|
316
800
|
export default App
|
|
317
801
|
|
|
318
802
|
- type: Markdown
|
|
319
803
|
content: |
|
|
320
|
-
**
|
|
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
|
+
|
|
321
817
|
- type: SyntaxHighlighter
|
|
322
818
|
language: yaml
|
|
323
819
|
content: |
|
|
324
820
|
renderView:
|
|
325
821
|
- type: h1
|
|
326
|
-
content: "
|
|
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."
|
|
327
825
|
|
|
328
826
|
- type: Markdown
|
|
329
827
|
content: |
|
|
330
|
-
|
|
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
|
|