Skip to content

Commit 2c243fe

Browse files
authored
chore: update readme and add coverage report on build
1 parent 89dd767 commit 2c243fe

File tree

17 files changed

+15556
-70
lines changed

17 files changed

+15556
-70
lines changed

.github/workflows/release.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,11 @@ jobs:
4040
- name: NPM - test
4141
run: npm test
4242

43+
- name: NPM - coverage
44+
uses: coverallsapp/github-action@master
45+
with:
46+
github-token: ${{ secrets.GITHUB_TOKEN }}
47+
4348
- name: LERNA - build packages
4449
run: npm run build
4550
env:

.github/workflows/test.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,3 +37,8 @@ jobs:
3737

3838
- name: NPM - test
3939
run: npm test
40+
41+
- name: Coveralls
42+
uses: coverallsapp/github-action@master
43+
with:
44+
github-token: ${{ secrets.GITHUB_TOKEN }}

LICENCE

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
MIT License
2+
-----------
3+
4+
Copyright (c) 2019 Lokesh Rajendran
5+
Permission is hereby granted, free of charge, to any person
6+
obtaining a copy of this software and associated documentation
7+
files (the "Software"), to deal in the Software without
8+
restriction, including without limitation the rights to use,
9+
copy, modify, merge, publish, distribute, sublicense, and/or sell
10+
copies of the Software, and to permit persons to whom the
11+
Software is furnished to do so, subject to the following
12+
conditions:
13+
14+
The above copyright notice and this permission notice shall be
15+
included in all copies or substantial portions of the Software.
16+
17+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
18+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
19+
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
20+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
21+
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
22+
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
23+
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
24+
OTHER DEALINGS IN THE SOFTWARE.
25+
26+
English Česky

README.md

Lines changed: 164 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,11 @@
2626
<br/>
2727
<h1></h1>
2828

29-
### Features
29+
## What is Lesy JS
30+
31+
Lesy is a simplified CLI framework build with NodeJS and Typescript. Main purpose of lesy is to enable web UI so that users can run commands from GUI dashboard without much complex. But lesy also shines in maintainability and flexibility focusing more on developer experience and performance.
32+
33+
## Features
3034

3135
- **Language**&#8192;&#8192;&#8192;&#8192; - _Javascript and Typescript with @types_
3236
- **Flexibility**&#8192;&#8192;&#8192;&#8192; - _Able to change complete flow with middlewares_
@@ -38,47 +42,166 @@
3842
- **Lot more**&#8192;&#8192;&#8192;&#8192;&#8192; - _Features, sub-commands, boilerplate generator..._
3943
<br/> <br/>
4044

41-
### Installation
45+
## Installation and setup
4246

43-
Scaffold new project directly using npx command
47+
Lesy can be installed from Lesy CLI or manually.
4448

45-
```shell
46-
> npx lesy new my-cli
47-
```
49+
- #### Set it up from CLI
4850

49-
Or, you can install lesy cli globally and generate a new project
51+
Scaffold new project directly using npx command
5052

51-
```shell
52-
> npm i -g lesy
53-
> lesy new my-cli
54-
```
53+
```shell
54+
> npx lesy new my-cli
55+
```
5556

56-
<br/> <br/>
57+
Or, you can install lesy cli globally and generate a new project
5758

58-
[![asciicast](https://asciinema.org/a/cByzQns8RTNs5I117XolHSgAt.svg)](https://asciinema.org/a/cByzQns8RTNs5I117XolHSgAt)
59+
```shell
60+
> npm i -g lesy
61+
> lesy new my-cli
62+
```
5963

60-
Also you can create your own project setup and run lesy. [Learn more]().
61-
<br/> <br/>
64+
Once set up is done, follow the instructions that is displayed in the terminal.
6265

63-
### Basic Example
66+
[![asciicast](https://asciinema.org/a/cByzQns8RTNs5I117XolHSgAt.svg)](https://asciinema.org/a/cByzQns8RTNs5I117XolHSgAt)
6467

65-
```js
66-
#!/usr/bin/env node
68+
Also you can create your own project setup and run lesy. [Learn more]().
6769

68-
const lesy = require("@lesy/compiler");
69-
const commands = [{ name: "hello", run: () => console.log("hello world") }];
70+
<br/>
7071

71-
lesy({ commands }).parse();
72-
```
72+
- #### Manual setup
7373

74-
```shell
75-
./cmd hello
76-
```
74+
Install `@lesy/compiler` via `npm` or `yarn`
7775

78-
It is just a tiny bit of lesy. There are lot of other cool stuffs like, advance commands, middlewares, features, configs, and plugins. [Learn more]()
79-
<br/> <br/>
76+
```shell
77+
mkdir my-cli && cd my-cli
78+
npm install @lesy/compiler
79+
```
80+
81+
Then create a index file and add the below code
82+
83+
```js
84+
#!/usr/bin/env node
85+
86+
const lesy = require("@lesy/compiler");
87+
const commands = [{ name: "hello", run: () => console.log("hello world") }];
88+
89+
lesy({ commands }).parse();
90+
```
91+
92+
```shell
93+
./index hello
94+
```
95+
96+
## Lesy core parts
97+
98+
- #### Commands
99+
100+
Commands can be a simple object, or a function or a class. Also, you can provide a path to file or directory where lesy can discover all commands. There are lot of things you can do with commands like, deep nested sub commands, dynamic command execution, run asyncronous code, validate args and flags, etc.,
101+
102+
```js
103+
const lesy = require("@lesy/compiler");
104+
105+
const commands = [
106+
{
107+
name: "hello",
108+
run: () => console.log("Hello Buddy!"),
109+
},
110+
111+
function hello(cmd) {
112+
cmd.name = "hello";
113+
cmd.run = () => console.log("Hello Buddy!");
114+
},
115+
116+
class Hello {
117+
name = "hello";
118+
run() {
119+
console.log("Hello Buddy!");
120+
}
121+
},
122+
123+
`${__dirname}/commands/welcome.ts`,
124+
125+
`${__dirname}/commands`,
126+
];
127+
128+
lesy({ commands }).parse();
129+
```
130+
131+
To know more about formats, args, flags, context [check here](https://lesyjs.io/docs/core/commands)
132+
133+
<br/>
134+
135+
- #### Middlewares
136+
137+
Middlewares are sort of hooks, you can plug a middleware at multiple stages of the flow. This way you can add, change and manipulate the flow.
138+
139+
```js
140+
const lesy = require("@lesy/compiler");
141+
142+
const commands = [{ name: "hello", run: () => console.log("hello world") }];
143+
const middlewares = [
144+
{
145+
on: "END",
146+
run: (ctx) => {
147+
console.log("this will be printed after hello world");
148+
return ctx;
149+
},
150+
},
151+
];
80152

81-
### Plugins
153+
lesy({ commands, middlewares }).parse();
154+
```
155+
156+
To know more about hook points, async middlewares, parsing, context [check here](https://lesyjs.io/docs/core/middlewares)
157+
158+
<br/>
159+
160+
- #### Features
161+
162+
Features are simple object, which are accesible in both commands and middlewares. It is super useful if you are dealing with third party libraries and want to share with all commands and middlewares.
163+
164+
```js
165+
const lesy = require("@lesy/compiler");
166+
167+
const commands = [
168+
{ name: "hello", run: ({ feature }) => feature.sayHello() },
169+
];
170+
const features = [
171+
(feature) => {
172+
feature.sayHello = () => console.log("hello");
173+
},
174+
];
175+
176+
lesy({ commands, features }).parse();
177+
```
178+
179+
To know more about features [check here](https://lesyjs.io/docs/core/features)
180+
181+
<br/>
182+
183+
- #### Plugins
184+
185+
Plugins are collection of commands, middlewares and features. Can be a local plugin or any lesy plugin that can be installed from npm. [learn more](https://lesyjs.io/docs/core/plugins)
186+
187+
```js
188+
const lesy = require("@lesy/compiler");
189+
190+
const commands = [{ name: "hello", run: () => console.log("hello world") }];
191+
const plugins = [`${dirname}/plugins/my-custom-plugin`];
192+
193+
lesy({ commands, plugins }).parse();
194+
```
195+
196+
<br/>
197+
198+
- #### Even more
199+
200+
To learn about global configuration, validators, testbed, performance [check the documentation](https://lesyjs.io/docs/get-started/overview)
201+
202+
<br/>
203+
204+
## Available Plugins
82205

83206
- [**UI Pilot**](https://lesyjs.io/docs/plugins/pilot-ui)<br/>
84207
_Run commands in Web UI. Supports input, console, workspace and more..._
@@ -96,20 +219,16 @@ It is just a tiny bit of lesy. There are lot of other cool stuffs like, advance
96219
_Prompt if required args are not supplied_
97220
<br/> <br/>
98221

99-
### License
100-
101-
MIT
102-
103-
<!-- logo
104-
headline
105-
buttons
106-
docs link block
107-
intro
108-
pilot
109-
installation
110-
basic example
111-
features
112-
plugins
113-
contribution
114-
dev docs
115-
license -->
222+
## Contribution
223+
224+
Any kind of contibutions are welcome. :)
225+
<br/> <br/>
226+
227+
## Development
228+
229+
To run it in local, and to know in depth code login please [check here](https://lesyjs.io/docs/dev/sample2)
230+
<br/> <br/>
231+
232+
## License
233+
234+
MIT

0 commit comments

Comments
 (0)