Skip to content
This repository was archived by the owner on Feb 15, 2025. It is now read-only.

Commit c72486a

Browse files
committed
refactored main section
1 parent 7760b6b commit c72486a

File tree

6 files changed

+46
-50
lines changed

6 files changed

+46
-50
lines changed
File renamed without changes.

docs/main/Installation.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ sidebar_label: Installation
55
slug: /installation
66
---
77

8-
AgileTs is essentially a set of npm [packages](https://github.com/agile-ts/agile/tree/master/packages) that can be installed over [npm](https://www.npmjs.com/).
8+
`AgileTs` is essentially a set of node modules [packages](https://github.com/agile-ts/agile/tree/master/packages) that can be installed over [npm](https://www.npmjs.com/).
99

1010
### 🔑 Requirements
1111

docs/main/Introduction.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ Write minimalistic, boilerplate-free code that captures your intent.
5757

5858
### 🤸‍ Flexible
5959

60-
- Works in nearly any UI-Layer. Check [here](../Frameworks.md) if your preferred Framework is supported too.
60+
- Works in nearly any UI-Layer. Check [here](Frameworks.md) if your preferred Framework is supported too.
6161
- Surly behaves with the workflow which suits you best. No need for _reducers_, _actions_, ..
6262
- Has **0** external dependencies
6363

@@ -138,6 +138,8 @@ the [api](../packages/api/Introduction.md) package. If you click on one of them,
138138
about the package, an Installation Guide and all its features. In case of the [core](../packages/core/Introduction.md)
139139
package you find the [State](../packages/core/features/state/Introduction.md)
140140
and [Collection](../packages/core/features/collection/Introduction.md) docs in the Features Section.
141+
Be aware that `⚠️ WIP` isn't an actual package. It is meant to separate packages that are currently `work in progress`
142+
and not ready for the outer world.
141143

142144
### 📁 Examples
143145

docs/main/StyleGuide.md

Lines changed: 39 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -17,26 +17,23 @@ Feel free to choose one of them and adapt it to your needs.
1717

1818
## 🚀 Inspiration 1
1919

20-
In this Style-Guide, we have a so-called `core` at the top-level of our `src` folder beside our UI-Components.
20+
In this Style-Guide, we have a so-called `core` at the top-level of our `src` folder, besides our UI-Components.
2121
The `core` is thought to be the brain of our application and should contain all business logic
22-
and logic in general, that isn't specifically bound to a Component.
22+
and logic in general that isn't explicitly bound to a Component.
2323
This outsourcing of our logic makes our code more decoupled,
2424
portable, and above all easy testable.
2525

26-
Below you can see where our `core` should be located.
27-
26+
Below you see where our `core` might be located in the main tree.
2827
```js {3} title="MyApp"
2928
my-app
3029
├── src
3130
│ └── core
3231
│ └── render
3332
.
3433
```
35-
36-
To represent the `core` for a better understanding visual, I use one of a TODO application.
37-
This application has two main [Entities](#📁-entities), that can be handled by AgileTs.
38-
The **User** and of course the **TODO-Item**. These two parts are mapped in our `core`.
39-
34+
We use the `core` of a simple TODO application to visually illustrate how such a `core` can be constructed.
35+
Our todo application has two main [Entities](#📁-entities), that AgileTs can handle.
36+
The **User** and of course, the **TODO-Item**. These two parts are mapped in our `core`.
4037
```js title="TodoList-Core"
4138
core
4239
│── api
@@ -58,18 +55,19 @@ core
5855
|── index.ts
5956
.
6057
```
61-
Each property that you can find in the above shown graph, is described in detail below ⬇️.
58+
Each property you find above in the folder structure of the `TodoList-Core`, is described in detail below ⬇️.
6259

6360
## 📁 api
6461

65-
Our Todo-List has to communicate to a **Backend**, therefore we need something that creates http/s requests for us.
66-
I am using the [AgileTs API](../packages/api/Introduction.md) but you can use whatever you want.
62+
Our Todo-List has to communicate to a `backend`. Therefore, we need something that creates http/s requests for us.
63+
In the example, we use the [AgileTs API](../packages/api/Introduction.md) but you can use whatever you want.
64+
If your application doesn't need to communicate to a `backend,` you can entirely skip the `api` section.
6765

6866
### 📝 index.ts
6967

70-
To make simple rest calls possible, we initialize our api class here.
71-
These defined API instance gets mainly used in the [route](#📝-.routes.ts) section of an Entity.
72-
68+
To make rest calls possible, we initialize our api class in the `index` file in the `api` folder.
69+
The defined API Instance will be mainly used in the [route](#-routets) file of an [Entity](#-entities),
70+
where we define the single routes to the backend.
7371
```ts title="index.ts"
7472
import API from '@agile-ts/api';
7573

@@ -82,23 +80,21 @@ const api = new API({
8280
});
8381

8482
export default api;
85-
8683
```
8784

8885
## 📁 entities
8986

90-
Our `core` consists of several entities, which exist apart from each other, having their own independent existence. Each
91-
Entity manages its Data separately by doing rest calls or mutating States. This separation makes our `core` more
92-
structured, readable, and improves maintainability.
87+
Our `core` consists of several entities, which exist apart from each other, having their own independent existence.
88+
Each `Entity` manages its Data separately by doing rest calls or mutating States. This separation makes our `core` more
89+
structured, readable and improves maintainability.
9390

9491
**For instance:** <br />
95-
A _User Entity_ should only treat the whole logic of the User and shouldn't do rest calls for the _Todo Entity_.
92+
The _User Entity_ should only treat the user's whole logic and shouldn't do rest calls, for instance, for the _Todo Entity_.
9693

9794
### 📝 index.ts
9895

99-
Here we just export all [actions](#📝-.action.ts), [routes](#📝-.routes.ts), [interfaces](#📝-.interface.ts) and
100-
the [controller](#📝-.controller.ts). To properly import them in our UI-Layer later.
101-
96+
Here we just export all [actions](#-actionts), [routes](#-routets), [interfaces](#-interfacets) and
97+
the [controller](#-controllerts). To properly import them in our UI-Layer later, like `core.todo.createTodo()`.
10298
```ts title="index.ts in 📁todo"
10399
import * as actions from "./todo.actions";
104100
import * as controller from "./todo.controller";
@@ -115,11 +111,13 @@ export default {
115111

116112
### 📝 .action.ts
117113

118-
An action is any piece of code that modifies our `State`.
119-
In principle, actions always happen in response to an event. For example, a button got clicked.
114+
An action does handle the logic of our Entity. We should name the actions after action names like `createX`, `removeY`.
115+
In general, an action modifies the `State`, makes rest calls through the functions provided by the [route.ts](#-routets) file
116+
, and computes some values if necessary.
117+
In principle, actions always happen in response to an event. For example, if the add todo button got clicked.
120118

121119
**For instance:** <br />
122-
The creation of a Todo-Item in the UI-Layer triggers the `addTodo` action, which then mutates our State and makes rest calls.
120+
The creation of a Todo-Item in the UI-Layer triggers the `addTodo()` action, which then mutates our State and makes rest calls.
123121

124122
```ts title="todo.action.ts in 📁todo"
125123
import {TodoInterface} from './todo.interface';
@@ -140,9 +138,8 @@ export const addTodo = async (userId: string, description: string): Promise<void
140138

141139
### 📝 .controller.ts
142140

143-
The Controller of an Entity holds and controls States, Collections, .. for that Entity.
144-
These Agile Sub Instances might get modified by [actions](#📝-.action.ts) or bound to a Component in the UI-Layer.
145-
141+
The Controller manages and represents the Agile Sub Instance like States, Collections, .. for the Entity.
142+
These Agile Sub Instances might get modified by the [action.ts](#📝-.action.ts) or bound to a Component in the UI-Layer.
146143
```ts title="todo.controller.ts in 📁todo"
147144
import {App} from '../../app';
148145
import {TodoInterface} from './todo.interface';
@@ -165,11 +162,11 @@ The `interface` section can be ignored by non [Typescript](https://www.typescrip
165162

166163
:::
167164

168-
If you are a [Typescript](https://www.typescriptlang.org/) user, you properly want to create an interface for your entity.
169-
These interfaces belonging to this entity should be defined here.
165+
If you are a [Typescript](https://www.typescriptlang.org/) user, you properly want to create some interfaces for your Entity.
166+
These interfaces belonging to this Entity should be defined here.
170167

171168
**For instance** <br />
172-
In case of the TODO-Entity, it contains a _TodoInterface_.
169+
In case of the TODO-Entity, it contains the `TodoInterface`.
173170

174171
```ts title="todo.interface.ts in 📁todo"
175172
export interface TodoInterface {
@@ -182,11 +179,10 @@ export interface TodoInterface {
182179

183180
### 📝 .route.ts
184181

185-
To communicate to our server, we have to create [rest calls](https://en.wikipedia.org/wiki/Representational_state_transfer).
186-
For better maintainability, these rest calls are provided here in function shape
187-
and should only be used in [actions](#📝-.action.ts) of the Entity.
182+
In order to communicate to our server, we have to create [rest calls](https://en.wikipedia.org/wiki/Representational_state_transfer).
183+
For better maintainability, these rest calls are outsourced from the [action.ts](#-actionts) and provided by this section in function shape.
184+
The routes should only be used in the [action.ts](#-actionts) of the Entity.
188185
It's not recommended calling them from outside the corresponding Entity.
189-
190186
```ts title="todo.route.ts in 📁todo"
191187
import {TodoInterface} from "./todo.interface";
192188
import api from "../../api";
@@ -202,15 +198,14 @@ export const ADD_TODO = async (payload: AddTodoPayloadInterface): Promise<TodoIn
202198
}
203199

204200
// ..
205-
206201
```
207202

208203
## 📝 app.ts
209204

210-
In this file, we create our main `Agile Instance` and configure it to meet our needs.
211-
For example, we determine here with which UI framework AgileTs works together.
212-
States, Collections, etc. then can be created with help of this Instance.
213-
**It's not recommended having multiple `Agile Instances` in one Application!!**
205+
In the `app` file, we create our main `Agile Instance` and configure it to meet our needs.
206+
For example, we determine here with which UI framework AgileTs should work together.
207+
States, Collections, etc. can then be created with the help of this instance.
208+
**It's not recommended to have multiple `Agile Instances` in one application!!**
214209

215210
```ts title="app.ts"
216211
import {Agile} from "@agile-ts/core";
@@ -222,9 +217,8 @@ export const App = new Agile({logJobs: true}).use(reactIntegration);
222217
## 📝 index.ts
223218

224219
Here we export our `core` entities so that each entity can be reached without any detours.
225-
For instance, we might import the `core` in our UI-Layer.
226-
There we than just import our `core` and mutate each entity from it like `core.todo.addTodo(/* */)`.
227-
220+
In our UI-Layer we than simply import our `core` and can mutate entities like the Todo-Entity (`core.todo.addTodo(/* */)`)
221+
without further thinking.
228222
```ts title="index.ts"
229223
import todo from "./controllers/todo";
230224
import user from "./controllers/user";
@@ -235,7 +229,7 @@ const core = {
235229
user: user,
236230
};
237231

238-
// For better debugging you might want our core global (Don't do that in PRODUCTION!!)
232+
// For better debugging, you might want our core global (Don't do that in PRODUCTION!!)
239233
globalBind("__core__", core);
240234

241235
export default core;

docs/packages/core/features/integration/Introduction.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ slug: /core/integration
99

1010
The `Integration Class` is useful for creating an Integration for a specific Framework.
1111
Luckily there already exists some Integrations, so we don't have to built them from scratch.
12-
Check [here](../../../../Frameworks.md) if your required Integration already exists.
12+
Check [here](../../../../main/Frameworks.md) if your required Integration already exists.
1313

1414
:::
1515

@@ -129,7 +129,7 @@ function useAgile(deps: Array<State | Collection | Observer | undefined>, agileI
129129
```
130130

131131

132-
## Subscriptions
132+
## 🛠 Subscriptions
133133

134134
To properly create an Integration for AgileTs,
135135
we need a basic understanding of how States can be bound/subscribed to Components.

sidebars.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ module.exports = {
88
'main/introduction',
99
'main/installation',
1010
'main/style-guide',
11+
'main/frameworks',
1112
'main/contributing',
1213
],
1314
},
@@ -167,6 +168,5 @@ module.exports = {
167168
],
168169
},
169170
'interfaces',
170-
'frameworks',
171171
],
172172
};

0 commit comments

Comments
 (0)