blend-r 1.1.6

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.
Files changed (30) hide show
  1. package/README.md +213 -0
  2. package/dist/helper/ApiHelper.js +766 -0
  3. package/dist/helper/BasicHelper.js +43 -0
  4. package/dist/helper/DataHelper.js +231 -0
  5. package/dist/helper/FrontEndHelper.js +201 -0
  6. package/dist/helper/fileHelper.js +127 -0
  7. package/dist/helper/grammarHelper/BlendApiGrammarHelper.js +90 -0
  8. package/dist/helper/grammarHelper/BlendBasicGrammarHelper.js +135 -0
  9. package/dist/helper/grammarHelper/BlendDataGrammarHelper.js +47 -0
  10. package/dist/helper/grammarHelper/GrammarErrorHelper.js +16 -0
  11. package/dist/index.js +87 -0
  12. package/dist/parser/blendApi/src/grammar/BlendApiLexer.js +207 -0
  13. package/dist/parser/blendApi/src/grammar/BlendApiListener.js +3 -0
  14. package/dist/parser/blendApi/src/grammar/BlendApiParser.js +978 -0
  15. package/dist/parser/blendData/src/grammar/BlendDataLexer.js +154 -0
  16. package/dist/parser/blendData/src/grammar/BlendDataListener.js +3 -0
  17. package/dist/parser/blendData/src/grammar/BlendDataParser.js +642 -0
  18. package/dist/parser/blendRBasic/src/grammar/BlendRBasicListener.js +3 -0
  19. package/dist/parser/blendRBasic/src/grammar/blendRBasicLexer.js +184 -0
  20. package/dist/parser/blendRBasic/src/grammar/blendRBasicParser.js +993 -0
  21. package/dist/parser/blendRnBasic/src/grammar/BlendRnBasicLexer.js +214 -0
  22. package/dist/parser/blendRnBasic/src/grammar/BlendRnBasicListener.js +3 -0
  23. package/dist/parser/blendRnBasic/src/grammar/BlendRnBasicParser.js +1224 -0
  24. package/dist/types/apiOperationTypes.js +20 -0
  25. package/dist/types/basicOperationTypes.js +3 -0
  26. package/dist/types/dataOperationTypes.js +2 -0
  27. package/dist/types/frontendOperationTypes.js +4 -0
  28. package/dist/types/generalTypes.js +0 -0
  29. package/dist/types/mongoOperationTypes.js +12 -0
  30. package/package.json +36 -0
package/README.md ADDED
@@ -0,0 +1,213 @@
1
+ # 📦 Blend RN - **Just chop, prepare and serve the code.**
2
+
3
+ **Blend RN** is a custom DSL-based React Native project generator. It allows developers to declare app layouts, screens, navigation structure, API endpoints, and data models using a simple, readable grammar, and then automatically generates React Native boilerplate code.
4
+
5
+ ---
6
+
7
+ ## 📖 Grammar Overview
8
+
9
+ Blend RN supports three grammar types:
10
+
11
+ 1. `.rbasic` – for app layout/navigation
12
+ 2. `.api` – for defining API endpoints
13
+ 3. `.data` – for defining data models
14
+
15
+ ---
16
+
17
+ ## 📑 `.rbasic` Example
18
+
19
+ ```blend
20
+ layout Auth type(Stack) {
21
+ page LandingScreen
22
+ page SplashScreen
23
+ }
24
+ ```
25
+
26
+ ### 📚 `.rbasic` Grammar Explanation
27
+
28
+ | Keyword | Description | Example |
29
+ |:----------|:------------------------------------------------|:--------------------------------|
30
+ | `layout` | Defines a navigation layout (Stack, Drawer, Tab) | `layout Auth type(Stack)` |
31
+ | `page` | Defines a screen/page inside a layout | `page SplashScreen` |
32
+ | `type` | Specifies the navigation type for a layout | `type(Stack)`, `type(Drawer)` |
33
+
34
+ #### 📌 Supported Navigation Types:
35
+ - `Stack`
36
+ - `Drawer`
37
+ - `Tab`
38
+
39
+ You can nest layouts and pages to build multi-level navigation structures.
40
+
41
+ ---
42
+
43
+ ## 🌐 `.api` Example
44
+
45
+ ```blend
46
+ module User
47
+
48
+ section Auth {
49
+ api login(POST) "/login" {
50
+ input(email: string, password: string)
51
+ output(string)
52
+ }
53
+
54
+ api logout(POST) "/logout" {
55
+ authenticated
56
+ output(string)
57
+ }
58
+ }
59
+ ```
60
+
61
+ ### 📚 `.api` Grammar Highlights
62
+
63
+ | Keyword | Description |
64
+ |------------------|--------------------------------------------|
65
+ | `module` | Declares an API module |
66
+ | `section` | Groups related APIs |
67
+ | `api` | Declares an API with method and path |
68
+ | `authenticated` | Marks API as needing auth token |
69
+ | `input` | Defines expected request payload fields |
70
+ | `output` | Defines expected response structure |
71
+
72
+ ✅ You can use types, optional fields (`?`), arrays (`[]`), and relational mappings (`TypeA -> TypeB`).
73
+
74
+ ---
75
+
76
+ ## 🗃️ `.data` Example
77
+
78
+ ```blend
79
+ module UserData
80
+
81
+ data User(id: string, name: string, email: string)
82
+ data Profile(userId: string -> User, bio: string?)
83
+ ```
84
+
85
+ ### 📚 `.data` Grammar Highlights
86
+
87
+ | Keyword | Description |
88
+ |-----------|----------------------------------------|
89
+ | `module` | Declares a data module |
90
+ | `data` | Defines a data structure |
91
+ | `->` | Declares a reference/relation type |
92
+ | `?` | Makes a field optional |
93
+ | `[]` | Declares an array of a type |
94
+
95
+ ---
96
+
97
+ ## 🛠️ Blend RN CLI Commands
98
+
99
+ Blend RN provides a simple CLI interface to process grammar files and generate your app’s codebase.
100
+
101
+ ### 1️⃣ `blend-r chop`
102
+
103
+ **Purpose:**
104
+ Parses the grammar files (`.rbasic`, `.api`, `.data`) and converts them into intermediate JSON representations.
105
+
106
+ **Usage:**
107
+ ```bash
108
+ blend-r chop
109
+ ```
110
+
111
+ ---
112
+
113
+ ### 2️⃣ `blend-r prepare`
114
+
115
+ **Purpose:**
116
+ Reads the intermediate JSON files generated by `chop` and creates the necessary React Native components, API services, data types, and navigation structure.
117
+
118
+ **Usage:**
119
+ ```bash
120
+ blend-r prepare
121
+ ```
122
+
123
+ ---
124
+
125
+ ### 3️⃣ `blend-r serve`
126
+
127
+ **Purpose:**
128
+ Starts the React Native Metro bundler and runs the application on the configured emulator or connected device.
129
+
130
+ **Usage:**
131
+ ```bash
132
+ blend-r serve
133
+ ```
134
+
135
+ ---
136
+
137
+ ## 📂 Example Workflow
138
+
139
+ ### Example Files:
140
+
141
+ #### 📁 `project/app.rbasic`
142
+ ```blend
143
+ layout Auth type(Stack) {
144
+ page LandingScreen
145
+ page SplashScreen
146
+ }
147
+ ```
148
+
149
+ #### 📁 `project/spec/api/user.api`
150
+ ```blend
151
+ module User
152
+
153
+ section Auth {
154
+ api login(POST) "/login" {
155
+ input(email: string, password: string)
156
+ output(string)
157
+ }
158
+ }
159
+ ```
160
+
161
+ #### 📁 `project/spec/data/user.data`
162
+ ```blend
163
+ module UserData
164
+
165
+ data User(id: string, name: string, email: string)
166
+ ```
167
+
168
+ ### Run the commands:
169
+
170
+ ```bash
171
+ blend-r chop
172
+ blend-r prepare
173
+ blend-r serve
174
+ ```
175
+
176
+ ✅ This will:
177
+ - Parse the grammar files
178
+ - Generate screens and layout components
179
+ - Generate API services and types
180
+ - Build a working React Native app
181
+
182
+ ---
183
+
184
+ ## 📦 Project Structure (After `prepare`)
185
+
186
+ ```
187
+ src-gen/
188
+ └── router/
189
+ └── config/
190
+ └── LayoutConfig.tsx
191
+ └── redux/
192
+ ├── ApiModuleSection/
193
+ └── ApiSection/
194
+ └── Api/
195
+ └── action.ts/
196
+ └── slice.ts/
197
+ └── selector.ts/
198
+ └── data.ts/
199
+ └── data/
200
+ └── data.ts
201
+ ```
202
+
203
+ ---
204
+
205
+ ## 📞 Support
206
+
207
+ For issues, improvements, or suggestions — feel free to raise a ticket or contact the project maintainer.
208
+
209
+ ---
210
+
211
+ ## 📃 License
212
+
213
+ This project is licensed under the [MIT License](LICENSE).