Skip to content

Commit 5c27232

Browse files
committed
docs: add flow image and update dev section
1 parent 8a83097 commit 5c27232

File tree

5 files changed

+124
-28
lines changed

5 files changed

+124
-28
lines changed

docs/package-lock.json

Lines changed: 19 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/src/markdown/docs/dev/recipies/sample2.md

Lines changed: 99 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -18,41 +18,43 @@ Few things are considered as rules while developing,
1818
First lets see how the code is organised.
1919

2020
```bash
21-
lesy/
22-
benchmark/
23-
docs/
24-
packages/
25-
cli/
26-
compiler/ # includes ts node if it is typescript project
27-
core/ # handles user input and output
28-
testbed/
29-
types/
30-
helpers/
31-
validator/
32-
misc/
33-
pilot-ui/
34-
test-utils/
35-
plugins/
36-
lesy-plugin-config/
37-
lesy-plugin-demo/
38-
lesy-plugin-generator/
39-
lesy-plugin-help/
40-
lesy-plugin-pilot/
41-
lesy-plugin-prompt/
42-
lesy-plugin-sidekick/
43-
lesy-plugin-store/
44-
lesy-plugin-validator/
21+
lesy
22+
├── benchmark/
23+
├── docs/
24+
└── packages/
25+
├── cli/
26+
├── compiler/ # includes ts node if it is typescript project
27+
├── core/ # handles user input and output
28+
├── testbed/
29+
├── types/
30+
├── helpers/
31+
│ └── validator/
32+
├── misc/
33+
│ ├── pilot-ui/
34+
│ └── test-utils/
35+
└── plugins/
36+
├── lesy-plugin-config/
37+
├── lesy-plugin-demo/
38+
├── lesy-plugin-generator/
39+
├── lesy-plugin-help/
40+
├── lesy-plugin-pilot/
41+
├── lesy-plugin-prompt/
42+
├── lesy-plugin-sidekick/
43+
├── lesy-plugin-store/
44+
└── lesy-plugin-validator/
4545
```
4646

4747
There were around **18 packages** in the lesy framework. But what really matters is `core` and `compiler`, others are supporting features.
4848

49+
> Below content is being updated with more examples and illustration.
50+
4951
### Core
5052

5153
As the name says, it is the heart <i class="ri-heart-3-fill text-primary"></i> of the project. Main responsibility of the core is take user commands, convert them to objects and run them. Nothing more. It is slim, and can live without other things in the project.
5254

5355
Core components include,
5456

55-
#### Command Contoller
57+
#### [Command Contoller](https://github.com/lokesh-coder/lesyjs/blob/master/packages/core/src/command.ts)
5658

5759
Takes commands, process and strore them in a nice format
5860

@@ -78,26 +80,96 @@ Orchestrate all the above components and run commands and middlewares
7880

7981
### Compiler
8082

83+
Compiler takes care of fewer tasks:
84+
85+
- If it is typescript project, loads ts-node to run ts files
86+
- If src file is provided, loads all files provided and pass to core
87+
- Runs code module and pass args provided in parse
88+
- Loads default plugins
89+
- Sets default config
90+
- If global workspace value is set, it just returns core promise.
91+
8192
### Plugins
8293

94+
Plugins directory consist of all lesy plugins
95+
8396
### Misc
8497

98+
It consist of two packages, Pilot UI and test utils. Both packages are internally used and not published to npm.
99+
100+
- Pilot UI is build with Angular and manages complete user interface logic. It is compiled and build by pilot plugin. Then the dist directory is served.
101+
102+
- Test utils used inside few of the packages. It contains few helper methods.
103+
85104
### Testbed
86105

106+
Used for integration test. Basically Testbed will run lesy with user provided data and collect all console output and returns.
107+
87108
### Types
88109

110+
Contains all the type definition files of the core package.
111+
89112
### CLI
90113

91-
### Helpers
114+
This package contains few lesy libraries and templates to scaffold new project based on the answers provided by users while initialising.
115+
116+
Unlike other packages, lesy CLI is not part of @lesy organisation in the npm. This is because, if it is under @lesy scope, then user have to do `npx @lesy/cli new my-cli`. To improve the user and developer experience, CLI package has been moved out of lesy org.
117+
118+
### Validator
119+
120+
This package is used to validate a object against a rules defined in another object. It works independently and not coupled with lesy in any way.
121+
122+
This library accepts custom rules.
123+
124+
### Compile and Build
92125

93-
### Build
126+
Lesy is build with node and typescript. And this project is maintained as a monorepo. Based on the need, either `ncc` or `tsc` compiler is used. `ncc` is mainly used to compress the file and reduce the size.
127+
128+
[lerna]() is used to handle bootstraping and executing build script in all projects.
94129

95130
### Release
96131

132+
[lerna]() is handle quite a few things here,
133+
134+
- Versioning based on **conventional commits**
135+
- Release all packages to npm
136+
- Create tag and push to github
137+
- Create release notes in github
138+
- Update CHANGELOG file
139+
- Update the new version in all package.json files
140+
97141
### Docs
98142

143+
Documentation is made using [gatsby](). All the markdown is build and published to `gh-pages` by the github actions.
144+
99145
### Pilot UI
100146

147+
Pilot UI is a angular project. Basically Pilot command in lesy will exposes necessary data though web sockets and Pilot UI receives and display.
148+
149+
When running command from UI, it send run signal and Pilot cmd runs the command and sends the ouput.
150+
101151
### Benchmark
102152

153+
[benny]() is used for benchmarking. [commander](), [gluegun](), and [yargs]() are used for comparition. The output JSON is used in the Performance page to represent as bar chart.
154+
103155
### How it works
156+
157+
<a href="/images/lesy-core-flow.png" target="_blank"><img src="/images/lesy-core-flow.png"/></a>
158+
159+
**core** has two main methods. `bootstrap` and `run`
160+
161+
**bootstrap(userData)**
162+
163+
- Takes the user provided data(commands, featutes, etc.,)
164+
- Passes all data to loader to extract the content.
165+
- Extracted content is saved in state
166+
- Executes middlewares hooked to `INIT` and `START`
167+
168+
**run(argv)**
169+
170+
- Takes user provided command args from the terminal or from `parse` method
171+
- Parse arguments and flags
172+
- Find the correct command from the args
173+
- Validate args and flags
174+
- Run command
175+
- During this flow it executes middlewares hooked to `PRE_PARSE`, `POST_PARSE`, `PRE_VALIDATE`,`PRE_RUN`,`END`

docs/src/markdown/docs/main/develop/roadmap.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,9 @@ icon: lightbulb-flash-fill
99
- Autocorrect mispelled args
1010
- Notification
1111

12+
### Others
13+
14+
- Support for desktop app
15+
- Allow pilot to show registered middlewares
16+
1217
<!-- ### Improvement for Pilot plugin-->

docs/src/styles/tailwind.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ p {
6464
@apply leading-none;
6565
}
6666

67-
.content h4 a {
67+
.content h4 a.anchor {
6868
@apply hidden;
6969
}
7070

79.7 KB
Loading

0 commit comments

Comments
 (0)