Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
which-pm-runs
Advanced tools
The `which-pm-runs` npm package is designed to identify which package manager was used to invoke a script. This can be particularly useful in scenarios where scripts need to behave differently depending on the package manager (npm, yarn, pnpm, etc.) that is running them. It provides a simple API to detect the current package manager and can be used in various Node.js scripts to enhance cross-package manager compatibility.
Detecting the package manager
This feature allows you to detect which package manager is currently running the script. The function returns an object containing the name and version of the package manager. This can be useful for scripts that need to adjust their behavior based on the package manager, such as using different command-line options or handling lock files differently.
const whichPMRuns = require('which-pm-runs');
console.log(whichPMRuns());
Similar to `which-pm-runs`, `detect-package-manager` is designed to identify the package manager used in the current environment. It can detect npm, yarn, and pnpm. The main difference lies in the approach and additional features it might offer, such as more detailed detection mechanisms or broader support for package managers.
While `npm-which` is focused more on locating the binaries of npm packages installed in the local node_modules folder, it shares the concept of detecting npm-related tools with `which-pm-runs`. However, `npm-which` is more about finding the path to an executable rather than identifying the package manager itself.
Detects what package manager executes the process
Supports npm, pnpm, Yarn, cnpm. And also any other package manager that sets the npm_config_user_agent
env variable.
pnpm add which-pm-runs
'use strict'
const whichPMRuns = require('which-pm-runs')
whichPMRuns()
//> {name: "pnpm", version: "0.64.2"}
FAQs
Detects what package manager executes the process
The npm package which-pm-runs receives a total of 1,438,170 weekly downloads. As such, which-pm-runs popularity was classified as popular.
We found that which-pm-runs demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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.
Research
Security News
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.