Security News
Supply Chain Attack Detected in Solana's web3.js Library
A supply chain attack has been detected in versions 1.95.6 and 1.95.7 of the popular @solana/web3.js library.
preferred-pm
Advanced tools
The preferred-pm npm package is designed to detect and suggest the preferred package manager for a given project. It checks for lock files such as package-lock.json, yarn.lock, or pnpm-lock.yaml to determine which package manager was previously used with the project and suggests using the same one for consistency.
Detecting preferred package manager
This feature allows you to detect the preferred package manager for the current project by analyzing the lock files present in the project directory. The code sample demonstrates how to use the package to find and log the preferred package manager.
const preferredPM = require('preferred-pm');
(async () => {
const pm = await preferredPM(process.cwd());
if (pm) {
console.log(`The preferred package manager is ${pm.name}`);
} else {
console.log('No preferred package manager found');
}
})();
This package can be used to detect which package manager executes the current process. It is similar to preferred-pm in that it helps identify the package manager in use, but it does so at runtime rather than by checking lock files.
This package provides a way to check if the correct package manager is being used based on a configuration file. It is similar to preferred-pm in ensuring consistency in package manager usage but uses a different approach by relying on a config file.
Returns the preferred package manager of a project
package-lock.json
is present, npm is preferred.yarn.lock
is present, Yarn is preferred.pnpm-lock.yaml
is present, pnpm is preferred.bun.lockb
is present, Bun is preferred.node_modules
is present, tries to detect which package manager installed it.<pnpm|yarn|npm|bun> add preferred-pm
'use strict'
const preferredPM = require('preferred-pm')
preferredPM(process.cwd())
.then(pm => console.log(pm))
//> {name: "npm", version: ">=5"}
FAQs
Detects what package manager was used for installation
The npm package preferred-pm receives a total of 1,548,059 weekly downloads. As such, preferred-pm popularity was classified as popular.
We found that preferred-pm demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 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
A supply chain attack has been detected in versions 1.95.6 and 1.95.7 of the popular @solana/web3.js library.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.