saksh-pc2
v1.0.0
Published
Check required packages in a JavaScript file
Maintainers
Readme
📦 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-pc2After 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.js2️⃣ 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 mongooseIf 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 Founderrors 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 installThis 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! 🚀
