Plugin-Tutorial-Node-CLI

- Arshpreet Singh Sandhu | Purdue University

Connect with me on LinkedIN and Github

Welcome to the Node.js CLI Plugin Tutorial! This tutorial will guide you through the process of creating and registering custom plugins in your Node.js CLI text transformation application. By following these steps, you will learn how to extend the functionality of your CLI app with ease. Whether you're a beginner or an experienced developer, this tutorial will help you get started with plugin development.

Step 1 - Set Up the Project

Before we begin, let's make sure you have the base project set up. Clone this github repository and follow the instructions given on the README to run it on your local machine. Link to the repository - Node-CLI-Plugin-System

Step 2 - Create Plugin File

A) Create a New File:

Create a new file named alphabetCountPlugin.ts in your plugins directory.

B) Implement the Plugin:

In this file, you'll implement the TextPlugin interface and define the transformText method. This method will contain the logic to count the alphabets in the input text. 

An example is provided below.

Step 3 - Register the Plugin

After creating your plugin, the next step is to register it in the TextCLI class. This will make your plugin available for use within the CLI application.

A) Open textCLI.ts:

Open the textCLI.ts file where the CLI application is configured.

B) Register the Plugin:

Add the new plugin to the PluginManager. Provide the plugin name, package location, and indicate that the path is relative.

Congratulations ! You've successfully created and registered your plugin

You should test your plugin.

PRO TIPS

What to do after registering the plugin?

On your terminal, navigate to the src or root directory where your typescript files are and enter 'npx tsc' . Then navigate to the directory where your javascript files are transpiled and run the project using 'node index.js' . 

 

I built a plugin? What next?

Create a pull request and contribute to the github repository given above. Think of more creative plugins and enjoy building.

How can we connect?

Connect with me on LinkedIN/ Github and send me a dm.

“A Heartfelt Thank You to Medical Informatics Engineering, Fort Wayne”

I would like to extend my deepest gratitude to Medical Informatics Engineering, Fort Wayne, for providing me with the incredible opportunity to intern with such a forward-thinking and innovative company. This project, along with many others during my internship, has been a transformative experience for me.

A special thank you to our esteemed CEO, Doug Horner, whose unwavering guidance and support have been instrumental in my development. Doug's mentorship has not only helped me hone my technical skills but has also inspired me to contribute to open source projects and strive for excellence in all my endeavors.

About Me 

Visit my personal website to know more about me - link

Add comment

Comments

There are no comments yet.
Rating: 5 stars
1 vote