“How to create a nodejs command line utility using cjs and typescript” — Part 1

Praveen David Mathew
6 min readFeb 7, 2022

Description:

This article series gives you a basic Idea on how to create a opensource command line utility project using Nodejs, Github Actions, and Jest

This article specifically focusses on creating a simple commandline utility using typescripe and cjs in nodejs.

See the package i created : https://www.npmjs.com/package/postman-collection-url-updater

Finding the purpose:

The first step of creating something is to find a purpose , a need on why we need something, ask your self following question

  1. What is the purpose of creating this (What problem does it solves)
  2. How often does people face this issue and looks out for a solution
  3. How much time does such a solution save
  4. What are the alternatives and its drawback

So, in my case there was a need of migrating the project from the URL structure {{baseURL}}/{{version}}/path1/path2 to {{baseURL}}/{{version}}/basepath/path1/path2

I could have just passed the additional path to version variable but doesn’t looks correct as the variable intention was to store just version . So I thought to create a npm command line…

--

--

Praveen David Mathew
Praveen David Mathew

Written by Praveen David Mathew

An open source advocator/WebdriverIO Projectcommiter/Postman Supernova/Postman-html-extra contributor/Stack overflow sqa moderator/Speaker