LEARNNode CLI Automation

Node Module Dependencies

The Node.js CLI that you build is a node module that the user can use either with npx or install it globally with npm. So it is a global module.

The node module that you build and publish may need some functionalities. And you can achieve these features by using other node modules inside your module.

These modules that you use become the dependencies of your node module. Let’s take a deeper look at it.

Using Node Modules In Your Module

Let’s take an example. You are building a name CLI which is a global module that when runs prints your name, bio, socials, blogs, etc on the terminal. What node modules you may need?

For starters, you might want to add a nice welcome header. For this, you can use a node module named cli-welcome. Now to add colors in your CLI, you can use the chalk module. To make API requests, you use axios. The list goes on and on.

All of these modules come together and work in your open-source package that you eventually publish to npmjs.

Wrapping Up

You can use as many modules as you need. All of these additional modules will be the dependencies of your node module.

Posted by Saad (It's a work in progress: Needs copy editing review by Awais.)