Security News
vlt Debuts New JavaScript Package Manager and Serverless Registry at NodeConf EU
vlt introduced its new package manager and a serverless registry this week, innovating in a space where npm has stagnated.
@pnpm/read-modules-dir
Advanced tools
@pnpm/read-modules-dir is an npm package that allows you to read the contents of the node_modules directory. It provides a simple API to list all the packages installed in a node_modules directory, which can be useful for various tasks such as auditing dependencies, generating reports, or performing custom operations on installed packages.
List all packages in node_modules
This feature allows you to list all the packages in a specified node_modules directory. The code sample demonstrates how to use the package to read the contents of the node_modules directory and log the list of packages to the console.
const readModulesDir = require('@pnpm/read-modules-dir');
async function listPackages() {
const packages = await readModulesDir('path/to/node_modules');
console.log(packages);
}
listPackages();
Handle scoped packages
This feature allows you to handle scoped packages specifically. The code sample demonstrates how to filter and list only the scoped packages from the node_modules directory.
const readModulesDir = require('@pnpm/read-modules-dir');
async function listScopedPackages() {
const packages = await readModulesDir('path/to/node_modules');
const scopedPackages = packages.filter(pkg => pkg.startsWith('@'));
console.log(scopedPackages);
}
listScopedPackages();
The 'read-installed' package reads the installed packages in a node_modules directory and returns a tree structure of the dependencies. It provides more detailed information about each package, including version, dependencies, and more. Compared to @pnpm/read-modules-dir, 'read-installed' offers a more comprehensive view of the installed packages but may be more complex to use.
The 'npm-ls' package is a command-line tool that lists all the installed packages in a node_modules directory, similar to the 'npm ls' command. It provides a hierarchical view of the dependencies. Compared to @pnpm/read-modules-dir, 'npm-ls' is more focused on providing a command-line interface and may not be as easily integrated into custom scripts.
Finds all direct packages in node_modules
FAQs
Finds all direct packages in node_modules
We found that @pnpm/read-modules-dir demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
vlt introduced its new package manager and a serverless registry this week, innovating in a space where npm has stagnated.
Security News
Research
The Socket Research Team uncovered a malicious Python package typosquatting the popular 'fabric' SSH library, silently exfiltrating AWS credentials from unsuspecting developers.
Security News
At its inaugural meeting, the JSR Working Group outlined plans for an open governance model and a roadmap to enhance JavaScript package management.