Git Product home page Git Product logo

professormanhattan / template-npm-cli Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 0.0 2.64 MB

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

Home Page: https://megabyte.space

License: Other

Ruby 12.93% Dockerfile 0.13% JavaScript 2.56% Shell 60.96% Python 8.65% TypeScript 14.76%
bin cli commander cosmicconfig inquirer library manpage mblabs megabytelabs nestjs professormanhattan washingtondc

template-npm-cli's Introduction

NPM CLI Boilerplate

An NPM CLI maintained by Megabyte Labs



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


Table of Contents

Overview

This repository houses the starting template / boilerplate with the format that all Megabyte Labs 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 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:

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 (an improved fork of go-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 or simply run:

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 eco-system should use the same format and core dependencies. They should all be written in TypeScript. Because we use Angular as a first-class choice, NestJS 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 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 tests while we are developing the CLI and then use Nodemon 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.

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 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.

Contributing

Contributions, issues, and feature requests are welcome! Feel free to check the issues page. If you would like to contribute, please take a look at the contributing guide.

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. This project is MIT licensed.

template-npm-cli's People

Contributors

professormanhattan avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.