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