{"id":13495047,"url":"https://github.com/lokesh-coder/lesyjs","last_synced_at":"2025-03-21T02:33:16.662Z","repository":{"id":38532778,"uuid":"263689243","full_name":"lokesh-coder/lesyjs","owner":"lokesh-coder","description":"Node JS based CLI framework to build modern Command line applications (in Beta )","archived":false,"fork":false,"pushed_at":"2023-01-11T22:22:38.000Z","size":21543,"stargazers_count":33,"open_issues_count":9,"forks_count":2,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-10-12T05:44:56.145Z","etag":null,"topics":["cli","cli-framework","terminal","ui","webapp"],"latest_commit_sha":null,"homepage":"https://lesyjs.io","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lokesh-coder.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-05-13T16:48:07.000Z","updated_at":"2024-05-27T16:14:34.000Z","dependencies_parsed_at":"2023-02-09T08:15:30.299Z","dependency_job_id":null,"html_url":"https://github.com/lokesh-coder/lesyjs","commit_stats":null,"previous_names":[],"tags_count":19,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lokesh-coder%2Flesyjs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lokesh-coder%2Flesyjs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lokesh-coder%2Flesyjs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lokesh-coder%2Flesyjs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lokesh-coder","download_url":"https://codeload.github.com/lokesh-coder/lesyjs/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":221811380,"owners_count":16884305,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cli","cli-framework","terminal","ui","webapp"],"created_at":"2024-07-31T19:01:30.714Z","updated_at":"2024-10-28T09:12:22.934Z","avatar_url":"https://github.com/lokesh-coder.png","language":"TypeScript","readme":"\u003ch3 align=\"center\"\u003e\n  \u003ca\n    target=\"_blank\"\n    rel=\"noopener noreferrer\"\n    href=\"https://lesyjs.io\"\n    \u003e\u003cimg\n      width=\"50\"\n      alt=\"The Lounge\"\n      src=\"https://user-images.githubusercontent.com/1754676/116806447-a808a300-ab4a-11eb-9805-e774c9c36931.png\"\n      style=\"max-width: 100%\"\n  /\u003e\u003c/a\u003e \u003cbr/\u003e\n\u003ca\u003eLesy js\u003c/a\u003e\n\u003c/h3\u003e\n\u003ch3 align=\"center\"\u003e\n\t\u003e 𝙱𝚞𝚒𝚕𝚍 𝚖𝚘𝚍𝚎𝚛𝚗 𝚌𝚘𝚖𝚖𝚊𝚗𝚍-𝚕𝚒𝚗𝚎 𝚊𝚙𝚙𝚜 _\n\u003c/h3\u003e\n\n\u003cp align=\"center\"\u003e\n\t\u003cspan\u003e\n\t\t\u003ca href=\"https://lesyjs.io/\"\u003ewebsite\u003c/a\u003e\n\t\t•\n\t\t\u003ca href=\"https://lesyjs.io/docs/getting-started/introduction\"\u003edocumentation\u003c/a\u003e\n\t\t•\n\t\t\u003ca href=\"https://codesandbox.io/s/lesy-pilot-playground-hzjgw?file=/src/index.js\"\u003eplayground\u003c/a\u003e\n\t\t•\n\t\t\u003ca href=\"https://twitter.com/lesyjs\"\u003e@lesyjs\u003c/a\u003e\n\t\u003c/span\u003e\n\u003c/p\u003e\n\n\u003ch1\u003e\u003c/h1\u003e\n\u003cbr/\u003e\n\u003cp align=\"center\"\u003e\n\n\u003cimg src=\"https://img.shields.io/coveralls/github/lokesh-coder/lesyjs?color=4a5874\u0026labelColor=bc5251\u0026style=flat-square\"/\u003e\n\u003cimg src=\"https://img.shields.io/github/workflow/status/lokesh-coder/lesyjs/Release?color=4a5874\u0026labelColor=bc5251\u0026style=flat-square\"/\u003e\n\u003cimg src=\"https://img.shields.io/npm/v/@lesy/core?color=4a5874\u0026labelColor=bc5251\u0026style=flat-square\"/\u003e\n\u003cimg src=\"https://img.shields.io/bundlephobia/minzip/@lesy/core?color=4a5874\u0026labelColor=bc5251\u0026label=core%20size%20\u0026style=flat-square\"/\u003e\n\u003cimg src=\"https://img.shields.io/npm/dt/lesy?color=4a5874\u0026labelColor=bc5251\u0026style=flat-square\"/\u003e\n\n\u003c/p\u003e\n\n\u003ch1\u003e\u003c/h1\u003e\n \u003cbr/\u003e\n\nA developer friendly **Node js based CLI framework** to build modern command line applications.\n\nWhether you are building a tiny teeny app or large complex one, Lesy provides you all the necessary tools out of box. That means, write less and get more with no additional cost to you and your users.\n\n \u003cbr/\u003e\n\n## Why Lesy\n\n- **Typescript support** \u003cbr/\u003e\n  First class typescript support with types and compiler \u003cbr/\u003e\u003cbr/\u003e\n- **Middleware architecture** \u003cbr/\u003e Change the flow at any stage or competely alter the behaviour without touching your core code \u003cbr/\u003e\u003cbr/\u003e\n- **Plugins system** \u003cbr/\u003e Bring in more features on demand with official/community plugins. \u003cbr/\u003e\u003cbr/\u003e\n- **Powerful commands** \u003cbr/\u003e Smart args/flags parsing, multi level sub commands, validators, multiple types, programatically running commands \u003cbr/\u003e\u003cbr/\u003e\n- **Reusable features** \u003cbr/\u003e Global data that can be accessed everywhere, whether it is a simple piece of code or 3rd part module \u003cbr/\u003e\u003cbr/\u003e\n- **Configuration** \u003cbr/\u003e App level configuration object to customize the settings \u003cbr/\u003e\u003cbr/\u003e\n- **Full-fledged Test suite** \u003cbr/\u003e write simple unit level testing or complete app level integration testing with simple API \u003cbr/\u003e\u003cbr/\u003e\n- **Lesy CLI** \u003cbr/\u003e Scaffold new project with just one simple command \u003cbr/\u003e\u003cbr/\u003e\n- **Performance** \u003cbr/\u003e Lesy core is lightweight and smart enough to run just what it needs. Benchmark inside \u003cbr/\u003e\u003cbr/\u003e\n- **Dynamic interface** \u003cbr/\u003e Rewrite terminal screen content on data change with bunch of inbuilt elements \u003cbr/\u003e\u003cbr/\u003e\n- **Web UI** \u003cbr/\u003e Lesy's Pilot server brings all your commands to web ui, so your users can happily run commands from web UI \u003cbr/\u003e\u003cbr/\u003e\n- **Desktop UI** \u003cbr/\u003e installable desktop app, that runs all globally installed lesy projects, and users can run apps from their app \u003cbr/\u003e\u003cbr/\u003e\n- **Utilities** \u003cbr/\u003e Built-in lazy utilities to work with colors and spinner \u003cbr/\u003e\u003cbr/\u003e\n- **Serverless mode** \u003cbr/\u003e With Lesy's simple API, write a bot like app and run it in server\n\n \u003cbr/\u003e\n\n## Installation\n\nTo ease the setup process, Lesy comes with own CLI which scaffolds the project with all necessary tools included.\n\nIn your terminal run this command:\n\n```bash\nnpx lesy new my-cli\n```\n\nFor detailed installation guide and manual set up refer this [installation docs](https://lesyjs.io/docs/getting-started/installation).\n\n \u003cbr/\u003e\n\n## Basic example\n\n```js\nconst lesy = require(\"@lesy/compiler\");\n\nconst commands = [{ name: \"greet\", run: () =\u003e console.log(\"hello\") }];\nlesy({ commands }).parse();\n```\n\n```sh\n$ ./my-cli greet\n\"hello\"\n```\n\n \u003cbr/\u003e\n\n## Lesy core\n\n### Commands\n\nCommand is a simple object with a `run` function which will be executed on running the command.\n\n```js\nconst lesy = require(\"@lesy/compiler\");\n\nconst commands = [\n  {\n    name: \"hello\",\n    args: {\n      name: {\n        required: true,\n      },\n    },\n    run: ({ args }) =\u003e console.log(`Hello ${args.name}`),\n  },\n];\n\nlesy({ commands }).parse();\n```\n\n- Command can also be a `function` or `class`\n- You can also provide the command `file path` or the `directory path`\n- Run multi-level sub commands\n- Parse and validate args and flags\n- Run command programmatically\n- In-built lazy utilities that can be accessed from command context\n- Execute synchronous and asynchronous code\n\nCheck out [commands API guide](https://lesyjs.io/docs/components/commands) to know more about it.\n\n \u003cbr/\u003e\n\n### Middlewares\n\nMiddlewares are simple functions which will be executed during the lifecyle of command flow. With this, you will be able to add new functionallity, tweak and change the entire behaviour of the command at any point of the flow without changing the command logic.\n\n```js\nconst lesy = require(\"@lesy/compiler\");\n\nconst commands = [{ name: \"hello\", run: () =\u003e console.log(\"hello world\") }];\nconst middlewares = [\n  {\n    on: \"END\",\n    run: (ctx) =\u003e {\n      console.log(\"this will be printed after hello world\");\n      return ctx;\n    },\n  },\n];\n\nlesy({ commands, middlewares }).parse();\n```\n\nWith middleware you can do:\n\n- Async calls\n- Programatically change running command\n- Modify args and flags\n- Terminate the flow\n- Intercept and change the output\n- Print additional info at any stages\n- Capture and send logs to other services\n- Include data in command context data\n- And much more..\n\nTo know more about hook points, async operations, parsing, context check [middleware docs](https://lesyjs.io/docs/components/middlewares)\n\n \u003cbr/\u003e\n\n### Features\n\nFeatures are simple global 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.\n\n```js\nconst lesy = require(\"@lesy/compiler\");\n\nconst commands = [{ name: \"hello\", run: ({ feature }) =\u003e feature.sayHello() }];\nconst features = [\n  (feature) =\u003e {\n    feature.sayHello = () =\u003e console.log(\"hello\");\n  },\n];\n\nlesy({ commands, features }).parse();\n```\n\nTo know more about features [check here](https://lesyjs.io/docs/components/features)\n\n \u003cbr/\u003e\n\n### Plugins\n\nPlugin is a collection of commands, middlewares, features and validators. Can be a local plugin or any lesy plugin that can be installed from npm. [learn more](https://lesyjs.io/docs/components/features)\n\n```js\nconst lesy = require(\"@lesy/compiler\");\n\nconst commands = [{ name: \"hello\", run: () =\u003e console.log(\"hello world\") }];\nconst plugins = [\n  `${dirname}/plugins/my-custom-plugin`,\n  \"@lesy/lesy-plugin-generator\",\n];\n\nlesy({ commands, plugins }).parse();\n```\n\n- Pass config object to a plugin\n- Support for plugins for a plugin\n\n \u003cbr/\u003e\n\n### More\n\n- [Configuration](https://lesyjs.io/docs/components/configuration) - App level config object that can be accessed globally even with in plugins\n- [Validators](https://lesyjs.io/docs/components/validators) - Args and flag validations\n\n \u003cbr/\u003e\n\n## Testing\n\nGenerally commands, middlewares, features can be tested independently with Jest. But however, to test them with the app or to test a plugin **testbed** can be used\n\n```js\nimport { resolve } from \"path\";\nimport { LesyTestBed } from \"@lesy/testbed\";\nconst HelloCommand from \"../src/commands/hello\";\n\ndescribe(\"CLI\", () =\u003e {\n  let app;\n\n  beforeEach(() =\u003e {\n    app = new LesyTestBed({\n      root: resolve(__dirname, \"./\"),\n      commands: [HelloCommand],\n    });\n  });\n\n  it(\"should log proper output\", async () =\u003e {\n    let response = await app.run([\"greet\"]);\n    expect(response).toContain(\"hello yoyo!\");\n  });\n});\n```\n\nCheck out [Testbed docs](https://lesyjs.io/docs/testing/testbed) for more info.\n\n \u003cbr/\u003e\n\n## Arist UI\n\nArtist UI is an another cool plugin which helps you to render dynamic elements by updating the screen content on data change.\n\nArtist can also be used independently without lesy, and it comes with commonly used interface elements like, spinner, progress bar, log, colors, layout, and much more. Also, Artist can be extended with plugins! [View docs](https://lesyjs.io/plugins/official/artist)\n\n![image](https://lesyjs.io/images/render1612453288681.gif)\n\n \u003cbr/\u003e\n\n## Pilot web dashboard\n\nPilot Dashboard is one of the lesy plugins which allows you to view and run commands of any lesy projects from web UI. Pilot comes with inbuild customizable console panel, config viewer, prompt modal support, responsive layout and more. [View docs](https://lesyjs.io/plugins/official/pilot-dashboard)\n\n![image](https://user-images.githubusercontent.com/1754676/116905452-9f07f680-ac5c-11eb-882f-1ae35e84244a.png)\n\n \u003cbr/\u003e\n\n## Plugins\n\n- [**Pilot dashboard**](https://lesyjs.io/plugins/official/pilot-dashboard)\n  Run commands in Web UI. Supports input, console, workspace and more...\n- [**Artist UI**](https://lesyjs.io/plugins/official/artist)\n  Update console screen on data change with in build elements\n- [**Store**](https://lesyjs.io/plugins/official/local-store)\n  Key-value storage in the system\n- [**Config reader**](https://lesyjs.io/plugins/official/config-files)\n  Setup config files like myapp.config.json, myapp.config.yml, myapp.config.js\n- [**Scaffold generator**](https://lesyjs.io/plugins/official/scaffold-generator)\n  Generate projects with handlebars templating\n- [**Prompt**](https://lesyjs.io/plugins/official/prompt)\n  Wrapper around inquirer plugin for prompts and questions\n- [**Help**](https://lesyjs.io/plugins/official/auto-help)\n  Automatically generate beautiful help with sub commands support. Highly customizable\n- [**Arg validator**](https://lesyjs.io/plugins/official/arg-validator)\n  Prompt if required args are not supplied\n\n   \u003cbr/\u003e\n\n## Standalone libraries\n\nThere are few components which can be used without Lesy.\n\n- [**Artist**](https://lesyjs.io/libraries/standalone/artist-UI)\n  Artist is an independent library which helps you to update console screen on data change. And not just that, Artist also comes bundled with all necessary elements like spinner, colums, tables, progress bar and more to spice up the visuals.\n- [**Object Validator**](https://lesyjs.io/libraries/standalone/object-validator)\n  A lightweight bare minimum core library to validate simple objects with your own custom rules and conditions. This also lets you to use async rules, custom response messages.\n\n   \u003cbr/\u003e\n\n## Contribution\n\nAny Contributions are welcome!\n\n \u003cbr/\u003e\n\n## Developement\n\nRefer this [local setup](https://lesyjs.io/docs/development/local-setup) guide for installing lesy in your local machine. And to know more indepth concepts check [project overiew](https://lesyjs.io/docs/development/project-overview) and [concepts](https://lesyjs.io/docs/development/indepth-concepts) page.\n\n \u003cbr/\u003e\n\n## License\n\nThis project is licensed under the **MIT License**\n","funding_links":[],"categories":["TypeScript","Packages","cli"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flokesh-coder%2Flesyjs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flokesh-coder%2Flesyjs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flokesh-coder%2Flesyjs/lists"}