@ea-lab/reactive-json-docs 0.1.8 → 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.
|
@@ -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,7 +231,11 @@ renderView:
|
|
|
157
231
|
)
|
|
158
232
|
```
|
|
159
233
|
|
|
160
|
-
|
|
234
|
+
**IMPORTANT**: do not use <StrictMode>. Reactive-JSON doesn't work with it for now!
|
|
235
|
+
|
|
236
|
+
---
|
|
237
|
+
|
|
238
|
+
### 10. Basic Configuration with ReactiveJsonRoot
|
|
161
239
|
|
|
162
240
|
**Action:** Configure the base component with an external YAML file
|
|
163
241
|
|
|
@@ -165,7 +243,7 @@ renderView:
|
|
|
165
243
|
|
|
166
244
|
**`src/App.tsx` (or `src/App.jsx`):**
|
|
167
245
|
|
|
168
|
-
```
|
|
246
|
+
```javascript
|
|
169
247
|
import { ReactiveJsonRoot } from '@ea-lab/reactive-json'
|
|
170
248
|
import 'bootstrap/dist/css/bootstrap.min.css'
|
|
171
249
|
|
|
@@ -184,7 +262,135 @@ renderView:
|
|
|
184
262
|
content: "Ready to start!"
|
|
185
263
|
```
|
|
186
264
|
|
|
187
|
-
|
|
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
|
|
188
394
|
|
|
189
395
|
**Action:** Launch development server
|
|
190
396
|
|
|
@@ -192,94 +398,244 @@ renderView:
|
|
|
192
398
|
npm run dev
|
|
193
399
|
```
|
|
194
400
|
|
|
195
|
-
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
|
|
406
|
+
- type: Markdown
|
|
407
|
+
content: |
|
|
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
|
|
415
|
+
|
|
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
|
|
441
|
+
|
|
442
|
+
First, ensure you're in the correct directory where your project will be created.
|
|
443
|
+
|
|
444
|
+
- type: SyntaxHighlighter
|
|
445
|
+
language: bash
|
|
446
|
+
content: |
|
|
447
|
+
pwd
|
|
448
|
+
|
|
196
449
|
- type: Markdown
|
|
197
450
|
content: |
|
|
198
|
-
|
|
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.
|
|
199
457
|
|
|
200
|
-
|
|
458
|
+
### Step 2: Choose Your Setup
|
|
201
459
|
|
|
202
|
-
|
|
460
|
+
Decide on your project configuration:
|
|
203
461
|
|
|
204
|
-
|
|
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)
|
|
205
464
|
|
|
206
|
-
|
|
465
|
+
**Recommended documentation location**: `~/cursor-docs/`
|
|
207
466
|
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
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:
|
|
213
479
|
|
|
214
|
-
### 2. Documentation Repositories Setup
|
|
215
|
-
Execute the following commands:
|
|
216
480
|
- type: SyntaxHighlighter
|
|
217
481
|
language: bash
|
|
218
482
|
content: |
|
|
219
|
-
|
|
483
|
+
# Create documentation directory
|
|
484
|
+
mkdir -p ~/cursor-docs
|
|
485
|
+
cd ~/cursor-docs
|
|
486
|
+
|
|
487
|
+
# Clone repositories
|
|
220
488
|
git clone https://github.com/Ealab-collab/reactive-json.git
|
|
221
489
|
git clone https://github.com/Ealab-collab/reactive-json-docs.git
|
|
222
490
|
|
|
223
491
|
- type: Markdown
|
|
224
492
|
content: |
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
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
|
|
229
541
|
|
|
230
542
|
- type: Markdown
|
|
231
543
|
content: |
|
|
232
|
-
###
|
|
544
|
+
### Step 6: Verify Project Structure
|
|
545
|
+
|
|
546
|
+
Confirm the project was created correctly:
|
|
547
|
+
|
|
233
548
|
- type: SyntaxHighlighter
|
|
234
549
|
language: bash
|
|
235
550
|
content: |
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
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"
|
|
241
575
|
|
|
242
576
|
- type: Markdown
|
|
243
577
|
content: |
|
|
244
|
-
###
|
|
578
|
+
### Step 7: Install Dependencies
|
|
579
|
+
|
|
580
|
+
Install Reactive-JSON and required packages:
|
|
581
|
+
|
|
245
582
|
- type: SyntaxHighlighter
|
|
246
583
|
language: bash
|
|
247
584
|
content: |
|
|
585
|
+
# Install base dependencies
|
|
248
586
|
npm install
|
|
587
|
+
|
|
588
|
+
# Install Reactive-JSON and required packages
|
|
249
589
|
npm install @ea-lab/reactive-json bootstrap react-bootstrap axios clsx dnd-kit-sortable-tree html-react-parser js-yaml jsonpath lodash
|
|
250
590
|
|
|
251
591
|
- type: Markdown
|
|
252
592
|
content: |
|
|
253
|
-
###
|
|
254
|
-
|
|
593
|
+
### Step 8: Setup Cursor Rules
|
|
594
|
+
|
|
595
|
+
Copy Cursor IDE rules for optimal development experience:
|
|
596
|
+
|
|
255
597
|
- type: SyntaxHighlighter
|
|
256
598
|
language: bash
|
|
257
599
|
content: |
|
|
258
600
|
# Create rules directory
|
|
259
601
|
mkdir -p .cursor/rules
|
|
260
602
|
|
|
261
|
-
# Copy rules from
|
|
262
|
-
cp -r
|
|
263
|
-
|
|
264
|
-
# Copy and merge rules from reactive-json-docs
|
|
265
|
-
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/
|
|
266
606
|
|
|
267
607
|
- type: Markdown
|
|
268
608
|
content: |
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
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"
|
|
274
617
|
|
|
275
618
|
- type: Markdown
|
|
276
619
|
content: |
|
|
277
|
-
###
|
|
278
|
-
|
|
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
|
|
279
632
|
|
|
280
633
|
- type: Markdown
|
|
281
634
|
content: |
|
|
282
|
-
|
|
635
|
+
### Step 10: Configure Main Entry Point
|
|
636
|
+
|
|
637
|
+
Update `src/main.tsx` (or `src/main.jsx`):
|
|
638
|
+
|
|
283
639
|
- type: SyntaxHighlighter
|
|
284
640
|
language: typescript
|
|
285
641
|
content: |
|
|
@@ -294,11 +650,12 @@ renderView:
|
|
|
294
650
|
|
|
295
651
|
- type: Markdown
|
|
296
652
|
content: |
|
|
297
|
-
|
|
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`):
|
|
298
658
|
|
|
299
|
-
- type: Markdown
|
|
300
|
-
content: |
|
|
301
|
-
**File: src/App.tsx**
|
|
302
659
|
- type: SyntaxHighlighter
|
|
303
660
|
language: typescript
|
|
304
661
|
content: |
|
|
@@ -313,23 +670,211 @@ renderView:
|
|
|
313
670
|
|
|
314
671
|
- type: Markdown
|
|
315
672
|
content: |
|
|
316
|
-
|
|
673
|
+
Create `public/config.yaml`:
|
|
674
|
+
|
|
317
675
|
- type: SyntaxHighlighter
|
|
318
676
|
language: yaml
|
|
319
677
|
content: |
|
|
320
678
|
renderView:
|
|
321
679
|
- type: h1
|
|
322
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`):
|
|
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"
|
|
323
834
|
|
|
324
835
|
- type: Markdown
|
|
325
836
|
content: |
|
|
326
|
-
###
|
|
837
|
+
### Step 13: Start Development Server
|
|
838
|
+
|
|
839
|
+
Launch your development server:
|
|
840
|
+
|
|
327
841
|
- type: SyntaxHighlighter
|
|
328
842
|
language: bash
|
|
329
843
|
content: |
|
|
330
844
|
npm run dev
|
|
331
845
|
|
|
332
|
-
|
|
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)
|
|
333
878
|
|
|
334
879
|
templates:
|
|
335
880
|
|