Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/ProfessorManhattan/template-npm-cli

A boilerplate / starting template for NPM CLI packages (using Nest Commander)
https://github.com/ProfessorManhattan/template-npm-cli

bin cli commander cosmicconfig inquirer library manpage mblabs megabytelabs nestjs professormanhattan washingtondc

Last synced: 3 months ago
JSON representation

A boilerplate / starting template for NPM CLI packages (using Nest Commander)

Awesome Lists containing this project

README

        




NPM CLI logo





NPM CLI Boilerplate


An NPM CLI maintained by Megabyte Labs





Homepage


Contributing


Slack


Gitter


GitHub


GitLab






Version: 0.0.1


Build status


Dependency status reported by Depfu


Zip file size


Total downloads of @mblabs/npm-npm-cli on npmjs.org


Number of vulnerabilities from Snyk scan on @mblabs/npm-npm-cli


Documentation


License: MIT

>

**A boilerplate / starting template for NPM CLI packages (using Nest Commander)**


## Table of Contents

- [Overview](#overview)
- [Requirements](#requirements)
- [Developer Requirements](#developer-requirements)
- [NPM CLI Requirements](#npm-cli-requirements)
- [Test-Driven Development](#test-driven-development)
- [Development Tools](#development-tools)
- [Documentation](#documentation)
- [Contributing](#contributing)
- [Affiliates](#affiliates)
- [License](#license)

## Overview

This repository houses the starting template / boilerplate with the format that all [Megabyte Labs](https://megabyte.space) NPM CLIs should use. It bundles together NestJS, Nest Commander, and a few other recommended dependencies. It also includes Jest for Test-Driven Development (TDD).

## Requirements

If you are simply including this library in your project, all you need is a recent version of Node.js. **[Node.js >14.18.0](repository.project.node)** is sometimes required and is the only version range we actively support. Albeit, it is highly probable that lower versions will work as well depending on the requirements that this project imports.

### Developer Requirements

The following versions of Node.js and Python are required for development:

- **[Node.js >14.18.0](repository.project.node)**
- **[Python >3.10.0](repository.project.python)**

Other versions may work, but only the above versions are supported. Most development dependencies are installed automatically by our `Taskfile.yml` set-up (even Node.js and Python). Run `bash start.sh` to install **[Bodega](https://github.com/ProfessorManhattan/Bodega)** (an improved fork of [go-task](https://github.com/go-task/task)) and run the initialization sequence. The taskfiles will automatically install dependencies as they are needed, based on what development tasks you are running. For more information, check out the [CONTRIBUTING.md](https://github.com/megabyte-labs/template-npm-cli/blob/main/docs/CONTRIBUTING.md) or simply run:

```shell
npm run help
```

`npm run help` will ensure Bodega is installed and then open an interactive dialog where you can explore and learn about various developer commands.

## NPM CLI Requirements

All of the NPM CLIs in the [Megabyte Labs](https://megabyte.space) eco-system should use the same format and core dependencies. They should all be written in TypeScript. Because we use [Angular](https://angular.io/) as a first-class choice, [NestJS](https://nestjs.com/) was an easy choice for us to adopt because of the similarities. The fact that NestJS is wildly popular on GitHub does not hurt as well. And because we use NestJS, we decided to use [Nest Commander](https://nest-commander.jaymcdoniel.dev/) for our NPM CLIs.

### Test-Driven Development

Testing CLIs can be cumbersome without the right tools. We have found that the best way of testing a Nest Commander CLI app is to utilize Test-Driven Development principles. Instead of manually compiling the app each time you make a change to test the CLI, we can create [Jest](https://jestjs.io/) tests while we are developing the CLI and then use [Nodemon](https://nodemon.io/) to automatically run the tests everytime we make a change to any file.

We encourage you to adopt these principles and develop your tests while you code.

### Development Tools

You are probably already familiar with `npm run test` and `npm run build`. We take things a step further and provide a plethora of build tools that are housed in our `Taskfile.yml` and the accompanying files it includes. We encourage you to attempt to make use of `task npm:test:inspect` which will watch the files as you code, run the Jest tests whenever a change is made, and open a Chrome DevTools instance for advanced debugging via [ndb](https://github.com/GoogleChromeLabs/ndb).

To make sense of all the build tools we include in all of our projects, you can run `bash start.sh` (to make sure our task runner called [Bodega](https://github.com/megabyte-labs/Bodega) is installed) and then `task --menu` to show a sweet TUI that will help you navigate through the available commands. It integrates documentation right into the menu too!

### Documentation

A link to the [Nest Commander documentation can be found here](https://nest-commander.jaymcdoniel.dev/docs/).

## Contributing

Contributions, issues, and feature requests are welcome! Feel free to check the [issues page](https://github.com/megabyte-labs/template-npm-cli/issues). If you would like to contribute, please take a look at the [contributing guide](https://github.com/megabyte-labs/template-npm-cli/blob/master/docs/CONTRIBUTING.md).

Sponsorship





Dear Awesome Person,


I create open source projects out of love. Although I have a job, shelter, and as much fast food as I can handle, it would still be pretty cool to be appreciated by the community for something I have spent a lot of time and money on. Please consider sponsoring me! Who knows? Maybe I will be able to quit my job and publish open source full time.


Sincerely,

**_Brian Zalewski_**


Open Collective sponsors


GitHub sponsors


Patreon

### Affiliates

Below you will find a list of services we leverage that offer special incentives for signing up for their services through our special links:


MailChimp


DigitalOcean Referral Badge

## License

Copyright © 2020-2021 [Megabyte LLC](https://megabyte.space). This project is [MIT](https://gitlab.com/megabyte-labs/templates/npm-cli/-/blob/master/LICENSE) licensed.