/npmnpm

https://www.npmjs.com/package/@aryanshridhar/npmnpm

Primary LanguageTypeScriptMIT LicenseMIT

npmnpm

A quick CLI tool to look out for outdated packages within your Node project and update them if required!

Developed in a single day!

Installation

The package is already pushed to npm registry (https://www.npmjs.com/package/@aryanshridhar/npmnpm), to use it one can simply install it globally by -

npm install -g @aryanshridhar/npmnpm

To verify installation -

  • Restart your terminal.
  • Run
npmnpm --help 

This should successfully list out the available commands.

Screenshot 2022-06-03 at 6 14 01 PM

Building

Requirements

This package strictly requires a node version >=12.0.0. Use node -v to check the version of node installed. If the version is older than 12.0.0, update your node to the latest version (preferable) - docs.

Steps

In order to build locally, one can follow these steps -

  • Clone the repository with -
git clone https://github.com/dyte-submissions/dyte-vit-2022-aryanshridhar.git
  • Move into the directory created -
cd dyte-vit-2022-aryanshridhar/
  • Install the dependencies listed in package.json file -
npm install
  • To compile and build the project written in typescript, run -
npm run build
  • This should successfully create a build folder with name /lib in the root directory having the entrypoint file src/index.js.
  • To test it locally -
node bin/index.js --help

This should list out the standard help command similar to the image shown above.

CLI Commands

npmnpm comes with the following commands with options and arguments -

npmnpm

Lists out the name of repository and version in a tabular format. Make sure that the csv file is valid and is in path. Sample csv file is listed in examples below.

Usage:

npmnpm <file> <dependency_name@version>

If one wants to only use the latest version, then -

npmnpm <file> <dependency_name> --latest

If one wants to create pull request to update the dependency with the version passed (or latest if not passed) -

npmnpm <file> <dependency_name@version> --update

register

Registers and stores the user's Gitub PAT (Perssonal access token).
This command is necessary when passed an --update flag to create pull request updating the dependency otherwise it prompts the user to do so.

Usage:

npmnpm register <your_access_token_here>

Examples

Sample CSV File -

name,repo
dyte-react-sample-app,https://github.com/dyte-in/react-sample-app/
dyte-js-sample-app,https://github.com/dyte-in/javascript-sample-app/
dyte-sample-app-backend,https://github.com/dyte-in/backend-sample-app/

npmnpm

npmnpm input.csv axios@0.23.0

Example
Screen.Recording.2022-06-03.at.7.49.19.PM.mov

npmnpm input.csv axios --latest

Example
Screen.Recording.2022-06-03.at.7.50.24.PM.mov

npmnpm input.csv react@18.0.1 --update

Example
Screen.Recording.2022-06-03.at.7.50.24.PM.mov

(The created pull request can be seen here!)

register

npmnpm register <your_access_token>

Example
Screen.Recording.2022-06-03.at.7.59.44.PM.mov

(Don't worry! I have deleted that PAT now!)