Luciano Mammino 𝕏 Node.js Design Patterns Profile picture
#AWS #Serverless Hero & MVP. Senior Architect @fourTheorem, author of 📕 https://t.co/Vhhe4G4GCN & ✉️ https://t.co/XMK2BWythj #Nodejs, #JavaScript, #Rust 🦀 & #Cloud ☁️

Sep 15, 2022, 10 tweets

Here are 6 of my favorite third-party libraries when building CLI applications using #NodeJS

Want to know why?👇🧵

commander ➡️ npm.im/commander

Simple yet powerful command-line argument parser. It automatically generates help messages and can be configured to support multiple commands.

I ❤️ it bc it's not prescriptive, you can organize the code as you want (1 file or more).

conf ➡️ npm.im/conf

How many times did you have to store settings (creds & other preferences)? Where do you save the conf file? Which format do you use? How do you load and update the file?

Conf takes care of all of this (and more!) with an extremely simple API

enquirer ➡️ npm.im/enquirer

Did you ever need to interactively collect user data? Like a web form, but in a CLI app!

Enquirer offers you many ways to do that: from simple text prompt to more advanced input components!

open ➡️ npm.im/open

Do you want to open the user browser to a specific URL from your CLI app? Do you need to open another application, for instance, Visual Studio Code?

Good luck doing that correctly for every OS if you are not using something like `open`!

ora ➡️ npm.im/ora

What do you do when your CLI needs to wait for a resource to be loaded or for the user to complete an operation somewhere else (e.g. auth in a browser window)?

Of course, YOU SHOW A CATCHY SPINNER! 😜

`ora` does just that and it's beautiful!

cli-progress ➡️ npm.im/cli-progress

Back to waiting... what if you can show some real progress (like when downloading or uploading a file somewhere)?

Progress bars are a well-known solution and with `cli-progress` you can have dynamic progress bars in your terminal 🤓

🧐 What do you think? Do you have other CLI-related libraries that you like and use often?

Let me know here! I am always curious to learn from all of you! 🥰

If you liked this thread and want to see more of this, please consider following me and re-sharing this post!

I'd be grateful for that 🧡

📹 If you want to see me using some of these utilities, @eoins and I are hosting a series of live streams where we build a file transfer app from scratch on #AWS (with CLI app included!)

You can follow the next one here:

Share this Scrolly Tale with your friends.

A Scrolly Tale is a new way to read Twitter threads with a more visually immersive experience.
Discover more beautiful Scrolly Tales like this.

Keep scrolling