Skip to content

Commit ee51225

Browse files
committed
fix(docs): update typos and modify terms
1 parent 70989b0 commit ee51225

File tree

10 files changed

+114
-88
lines changed

10 files changed

+114
-88
lines changed

docs/src/markdown/docs/main/core/commands.md

Lines changed: 21 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ Command is a core part of lesy. You can create and add commands in multiple ways
1212
- Run multi-level sub commands
1313
- Run another command programatically
1414
- Parse and validate arguments and flags
15-
- Use features from app or plugins
15+
- Use features and utils from app or plugins
1616

1717
### Types of commands
1818

@@ -22,8 +22,8 @@ Command can be an `Object`, `Function` or `Class` .
2222

2323
```typescript
2424
{
25-
name:"hello",
26-
run:()=>console.log("Hello Buddy!")
25+
name: "hello",
26+
run: () => console.log("Hello Buddy!")
2727
}
2828
```
2929

@@ -94,19 +94,23 @@ export default {
9494

9595
### Anatomy of command
9696

97-
The only required properties for a command is `name` and `run` . Everything else is optional and used for other purposes.
97+
The only required property for a command is `run` . Everything else is optional.
9898

9999
#### name
100100

101101
It refers the name of the command. It should be unique and short. Hyphen `-` is allowed.
102102

103+
#### description
104+
105+
This is a command description used by help and other plugins.
106+
103107
#### run
104108

105-
This function or method will be executed when this command is triggered.
109+
It is a function which will be executed when this command is triggered.
106110

107111
#### aliases
108112

109-
Command can have multiple alias. Please make sure you are not using the same alias in the another command
113+
Command can have multiple aliases. Please make sure you are not using the same alias in the another command
110114

111115
```typescript
112116
{
@@ -124,14 +128,15 @@ Command can have multiple alias. Please make sure you are not using the same ali
124128

125129
#### args
126130

127-
These are the arguments schema. This has inbuild validation. [refer](foobar) [](/)Validator helper.
131+
These are the arguments schema. This has inbuild validation. [refer](foobar) Validator helper.
128132

129133
```typescript
130134
{
131135
name:"hello",
132136
args:{
133137
username:{
134-
required:true
138+
required:true,
139+
requiredError:"Please provide username",
135140
},
136141
age:{}
137142
},
@@ -173,14 +178,14 @@ $ node bin/cmd hello // THROWS ERROR
173178
*/
174179
```
175180

176-
#### extra
181+
#### additionalInfo
177182

178-
This extra text will be used by other plugins and middlewares. Originally, use case is for showing extra info about the command in help or pilot command
183+
This extra text will be used by other plugins and middlewares. Originally, use case is for showing info about the command in help or pilot command
179184

180185
```typescript
181186
{
182187
name:"delete",
183-
extra:"this command will delete all files. run with caution.",
188+
additionalInfo:"this command will delete all files. run with caution.",
184189
run:()=>{}
185190
}
186191
```
@@ -201,10 +206,6 @@ $ node bin/cmd generate component
201206
*/
202207
```
203208

204-
#### description
205-
206-
This is a command description used by help and other plugins.
207-
208209
#### usage
209210

210211
Sample usage code shown in the help command
@@ -246,6 +247,10 @@ The `run` method provides various data about the command and app.
246247
}
247248
```
248249

250+
#### data.utils
251+
252+
todo
253+
249254
### Sub commands
250255

251256
Commands can be nested multiple levels. If you want to make a sub-command, just add the parent name in `main` property. Other features of the command remains same for sub commands.
@@ -298,7 +303,7 @@ Please dont use parent name aliases
298303

299304
### Default command
300305

301-
By default **lesy** look for command named `default` if no args supplied in the input. If you would like to run different command as a default command, set it in the config.
306+
By default **lesy** looks for command named `default` if no args supplied in the input. If you would like to run different command as a default command, set it in the config.
302307

303308
```typescript
304309
{

docs/src/markdown/docs/main/core/middlewares.md

Lines changed: 41 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ path: /docs/core/middlewares
44
icon: fire-fill
55
---
66

7-
Middlewares are special type of hooks, to inject new functionality or change tge behaviour of the command flow. For instance, if you want to redirect the command, or validate the middleware can be hooked in to specific points in the flow. Basically, they are simple functions which will be execute at the runtime.
7+
Middlewares are special type of hooks, to inject new functionality or change the behaviour of the command flow. For instance, if you want to redirect the command or validate, the middleware can be hooked in to specific points in the flow. Basically, they are simple functions which will be execute at specific point during runtime.
88

99
### Hook points
1010

@@ -34,11 +34,10 @@ export default {
3434
Add the middleware file in the **index.ts** file.
3535

3636
```typescript
37-
let argv = process.argv.slice(2);
3837
let commands = [...];
3938
let middlewares = [`${__dirname}/middlewares/start.ts`];
4039

41-
export { argv, commands, middlewares };
40+
export { commands, middlewares };
4241
```
4342

4443
Middleware should return the input data to continue the flow.
@@ -76,9 +75,9 @@ This will run after loading all commands and plugins. The run context will have
7675
```typescript
7776
export default {
7877
on: "START",
79-
run: (data) => {
80-
console.log(data.cmds);
81-
return data;
78+
run: (ctx) => {
79+
console.log(ctx.cmds);
80+
return ctx;
8281
},
8382
};
8483
```
@@ -90,14 +89,14 @@ This will run before parsing raw argv input. At this point you can change **argv
9089
```typescript
9190
export default {
9291
on: "PRE_PARSE",
93-
run: (data) => {
94-
// data.argv - raw input argv values
95-
// data.root - root path
96-
// data.config - config object
97-
// data.utils - colors() and spinner() object
98-
// data.feature - all features
99-
// data.request - oject of dynamic actions
100-
return data;
92+
run: (ctx) => {
93+
// ctx.argv - raw input argv values
94+
// ctx.root - root path
95+
// ctx.config - config object
96+
// ctx.utils - colors() and spinner() object
97+
// ctx.feature - all features
98+
// ctx.request - oject of dynamic actions
99+
return ctx;
101100
},
102101
};
103102
```
@@ -109,17 +108,17 @@ Run after parsing raw argv values.
109108
```typescript
110109
export default {
111110
on: "PRE_PARSE",
112-
run: (data) => {
113-
// data.argv - raw input argv values
114-
// data.root - root path
115-
// data.config - config object
116-
// data.utils - colors() and spinner() object
117-
// data.feature - all features
118-
// data.request - oject of dynamic actions
119-
120-
// data.args - resolved args
121-
// data.flags - resolved flags
122-
return data;
111+
run: (ctx) => {
112+
// ctx.argv - raw input argv values
113+
// ctx.root - root path
114+
// ctx.config - config object
115+
// ctx.utils - colors() and spinner() object
116+
// ctx.feature - all features
117+
// ctx.request - oject of dynamic actions
118+
119+
// ctx.args - resolved args
120+
// ctx.flags - resolved flags
121+
return ctx;
123122
},
124123
};
125124
```
@@ -131,9 +130,9 @@ Once lesy found the right command to execute, it will pass the command object to
131130
```typescript
132131
export default {
133132
on: "PRE_VALIDATE",
134-
run: (data) => {
135-
console.log(data);
136-
return data;
133+
run: (ctx) => {
134+
console.log(ctx);
135+
return ctx;
137136
},
138137
};
139138
```
@@ -171,30 +170,31 @@ After validation passes, **pre_run** will be executed will all the necessary inf
171170
```typescript
172171
export default {
173172
on: "PRE_RUN",
174-
run: (data) => {
175-
// data.argv - raw input argv values
176-
// data.root - root path
177-
// data.config - config object
178-
// data.utils - colors() and spinner() object
179-
// data.feature - all features
180-
// data.request - oject of dynamic actions
181-
// data.args - resolved args
182-
// data.flags - resolved flags
183-
// data.rest - unknown args
184-
return data;
173+
run: (ctx) => {
174+
// ctx.argv - raw input argv values
175+
// ctx.root - root path
176+
// ctx.config - config object
177+
// ctx.utils - colors() and spinner() object
178+
// ctx.feature - all features
179+
// ctx.request - oject of dynamic actions
180+
// ctx.args - resolved args
181+
// ctx.flags - resolved flags
182+
// ctx.rest - unknown args
183+
return ctx;
185184
},
186185
};
187186
```
188187

189188
### END - Hook
190189

191-
This hook will run at the end of the command flow. There is no run context. Thus no need of return statement.
190+
This hook will run at the end of the command flow.
192191

193192
```typescript
194193
export default {
195194
on: "END",
196-
run: () => {
195+
run: (ctx) => {
197196
console.log("Command ran successfully!");
197+
return ctx;
198198
},
199199
};
200200
```

docs/src/markdown/docs/main/get-started/concepts.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,7 @@ title: Concepts
33
path: /docs/get-started/concepts
44
icon: honour-fill
55
---
6+
7+
Lesy is build based on frictionless sleek middleware architecture, thus maintaining the each core components work independently as well as play together.
8+
9+
<img src="/images/concept.png" width="360"/>

docs/src/markdown/docs/main/get-started/installation.md

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ path: /docs/get-started/installation
44
icon: folder-download-fill
55
---
66

7-
Setting up Lesy is pretty simple and straightforward.
7+
Setting up Lesy is pretty simple and straightforward. And there are two ways to do that. Use **Lesy CLI** or do it manually.
88

9-
### Generate project with CLI
9+
### Scaffold project with CLI
1010

1111
One easy way is using `npx` to generate project boilerplate with one command.
1212

@@ -42,7 +42,7 @@ lesy my-cli --yes
4242

4343
### Project structure
4444

45-
Here's how the project structure look like, after the project is generated
45+
Here's how the project structure look like, after the project is created
4646

4747
```
4848
my-cli
@@ -61,7 +61,7 @@ my-cli
6161

6262
### Manual setup
6363

64-
Actually manual set up is also easy.
64+
If you are creating a simple CLI project and dont want too many directories, then its pretty simple.
6565

6666
**Step 1**: Create new node project:
6767

@@ -76,28 +76,35 @@ cd my-cli
7676
npm install @lesy/compiler
7777
```
7878

79-
**Step 3**: Create `executable` bin file `my-cli/bin/cmd`
79+
**Step 3**: Create main `index.(js|ts)` file
8080

8181
```js
8282
#!/usr/bin/env node
8383

84-
const path = require("path");
8584
const lesy = require("@lesy/compiler");
8685

8786
lesy({
88-
root: path.resolve(__dirname, "../"),
89-
commands:[...],
87+
root: __dirname,
88+
commands: [
89+
{
90+
name: "default",
91+
run: () => console.log("hello"),
92+
},
93+
"./src/commands",
94+
],
9095
/* ...other props */
9196
}).parse();
9297
```
9398

94-
**Step 4**: Update executable file name in `package.json` file
99+
**Step 4**: Update bin property in `package.json` file
95100

96101
```json
97102
{
98103
"name": "my-cli",
99104
"bin": {
100-
"mycli": "bin/cmd"
105+
"mycli": "index.js"
101106
}
102107
}
103108
```
109+
110+
its done!

docs/src/markdown/docs/main/get-started/overview.md

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,33 +4,39 @@ path: /docs/get-started/overview
44
icon: user-smile-fill
55
---
66

7-
Lesy js is a flexible lightweight CLI framework to build modern command line apps without too much boilerplate.
7+
Lesy is just a simple lightweight CLI framework helps you to build modern and performant command line apps. Thats all!
88

9-
If you have already used commander, yargs, gluegun, then lesy js will definitely give you a new experience and you will feel the difference.
9+
Whether you are building a dead simple app or more advanced app, Lesy lets you to write less code and get more. Here's the sample code for classic Hello world example.
1010

11-
### Few things to consider Lesy for your next project
11+
```js
12+
const lesy = require("@lesy/compiler");
13+
14+
lesy({
15+
commands: [{ run: () => console.log("hello world") }],
16+
}).parse();
17+
```
18+
19+
### Why Lesy?
1220

1321
- **Language**: Full support for Typescript with @types
14-
- **Boilerplate**: Write less code. whether its a dead simple project or complex one.
1522
- **Flexibility**: Able to change complete behaviour with middlewares
23+
- **Boilerplate**: Write less code. whether its a dead simple project or complex one.
1624
- **Extensions**: Add cool functionalities with plugins
1725
- **Platform**: Write once and run in CLI or UI
1826
- **Performance**: It is just faster than existing libraries. Benchmark inside.
1927
- **Testing**: Dedicated testing setup for unit test and integration test
20-
- **Lot more**: Features, sub commands, existing plugins, Boilerplate generator...
28+
- **Lot more**: Features, sub commands, existing plugins, boilerplate generator...
2129

22-
### Try Lesy before installing
30+
### Lesy playground
2331

2432
We have a setup a _playground_ for you to play around with it.
2533

26-
[![Edit lesy-pilot-playground](https://codesandbox.io/static/img/play-codesandbox.svg)](https://codesandbox.io/s/lesy-pilot-playground-hzjgw?fontsize=14&hidenavigation=1&view=preview)
34+
[Pilot Playground](https://codesandbox.io/s/lesy-pilot-playground-hzjgw?fontsize=14&hidenavigation=1&view=preview)
2735

28-
### Why is the name Lesy?
36+
### What is the meaning of Lesy?
2937

30-
Well, there is no specific meaning for Lesy. The whole project is build with the mindset of simple and easy. Whether it is a code or documentation or name or logo, everything should be simple and easy. Name **Lesy** sounds cool and short.
38+
Well, there is no specific meaning for Lesy. The whole project is build with the mindset of simple and easy. Whether it is a code or documentation or name or logo, everything should be simple. **Lesy** sounds cool and short.
3139

3240
Same way, it is not related to penguin logo. Penguin is cute right? Lets make that as a logo and name it Lesy!!
3341

34-
<br/>
35-
36-
You should give it a try!
42+
Give it a try, you will like Lesy!

0 commit comments

Comments
 (0)