saksh-pc2 v1.0.0
š¦ saksh-pc2 - Node.js Package Checker
saksh-pc2
is a lightweight CLI tool that scans a JavaScript file to detect external dependencies (require()
and import
statements). It then suggests an npm install
command to install missing packages.
š Installation
To install saksh-pc2
globally, run:
npm install -g saksh-pc2
After installation, you can use the saksh-pc2
command from anywhere in your terminal.
š ļø Usage
1ļøā£ Check External Dependencies
To check which external packages are used in a JavaScript file, run:
saksh-pc2 app.js
2ļøā£ Example Output
If your file app.js
contains:
const express = require("express");
const mongoose = require("mongoose");
console.log("Server running...");
Running saksh-pc2 app.js
will output:
š¦ Detected external packages:
express
mongoose
š” To install them, run:
npm install express mongoose
If no external packages are found:
ā
No external packages detected.
āļø Features
ā
Scans JavaScript files for dependencies
ā
Supports both require()
(CommonJS) and import
(ES Modules)
ā
Generates an npm install
command
ā
Fast and lightweight
ā
No dependencies on large libraries
š” Why Use saksh-pc2
?
- Quickly check for missing dependencies before running your script.
- Prevent
Module Not Found
errors in production. - Ensure all required packages are installed before deployment.
- Simple and fast, with minimal dependencies.
š§ Advanced Usage
If you want to automatically install missing dependencies, you can modify the command:
saksh-pc2 app.js | xargs npm install
This will scan for missing packages and install them automatically.
šļø Contributing
If you find a bug or have suggestions, feel free to open an issue or submit a pull request.
š License
MIT License.
Happy coding! š
5 months ago