A boilerplate to build CLIs with JavaScript. No transpilers, just JavaScript.
CLIs are cool and useful. JavaScript is awesome and the most popular programming language of world. But, how to develop scalable and testable tools? What are the standards to be followed?
This project is a result of studies, based on experiencies and the Unix Philosophy.
Choose a option:
- Clone the repo or...
- Download last release.
The structure is simple:
├── bin/
│ └── app
├── doc/
│ └── help.txt
├── src/
| ├── helpers/
| | └── log-error.js
| ├── modules/
| | └── help.js
│ └── app.js
├── test/
│ └── help.test.js
├── .editorconfig
├── .gitignore
├── cli.js
├── package.json
└── README.md
The Node.js packages are based on CommonJS Packages/1.1, and this specification says that executable files must be in the directory /bin
.
Keep the documentation in external files leaves more flexible, especially if it's large.
The main modules, helpers a application file are here.
The test structure is based on ava, a futuristic JavaScript test runner. Alternatively, you can use another, the changes in this project are simple.
This is the main file of your application. It receives user input and the delegate to the necessary modules.
Luiz Fernando Rodrigues - http://fernahh.com.br
(The MIT License)
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.