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.
@pnpm/npm-conf
Advanced tools
@pnpm/npm-conf is a configuration management utility for Node.js projects. It allows you to handle npm configuration settings programmatically, making it easier to manage and customize npm behaviors within your applications.
Load Configuration
This feature allows you to load the npm configuration settings. The code sample demonstrates how to load the configuration and retrieve the value of the 'registry' setting.
const npmConf = require('@pnpm/npm-conf');
const config = npmConf();
console.log(config.get('registry'));
Set Configuration
This feature allows you to set npm configuration settings programmatically. The code sample shows how to set a custom registry URL and then retrieve it to verify the change.
const npmConf = require('@pnpm/npm-conf');
const config = npmConf();
config.set('registry', 'https://custom.registry.com');
console.log(config.get('registry'));
Save Configuration
This feature allows you to save the modified configuration settings back to the npm configuration file. The code sample demonstrates setting a custom registry URL and then saving this configuration.
const npmConf = require('@pnpm/npm-conf');
const config = npmConf();
config.set('registry', 'https://custom.registry.com');
config.save();
The 'rc' package is a non-npm-specific configuration loader that supports various configuration file formats and environment variables. It is more general-purpose compared to @pnpm/npm-conf, which is specifically tailored for npm configurations.
The 'config' package provides a way to manage configuration files for Node.js applications. It supports multiple environments and allows for hierarchical configurations. Unlike @pnpm/npm-conf, it is not focused on npm settings but rather on application-specific configurations.
The 'dotenv' package loads environment variables from a .env file into process.env. It is useful for managing environment-specific settings but does not provide the same level of npm-specific configuration management as @pnpm/npm-conf.
Get the npm config
$ pnpm add @pnpm/npm-conf
const npmConf = require('@pnpm/npm-conf');
const conf = npmConf();
conf.get('prefix')
//=> //=> /Users/unicorn/.npm-packages
conf.get('registry')
//=> https://registry.npmjs.org/
To get a list of all available npm
config options:
$ npm config list --long
Returns the npm
config.
Returns the default npm
config.
MIT © Kevin Mårtensson
FAQs
Get the npm config
The npm package @pnpm/npm-conf receives a total of 2,481,340 weekly downloads. As such, @pnpm/npm-conf popularity was classified as popular.
We found that @pnpm/npm-conf 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.
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.