libnpmconfig
libnpmconfig
is a Node.js library for programmatically managing npm's configuration files and data.
Table of Contents
Example
const config = require('libnpmconfig')
console.log('configured registry:', config.read({
registry: 'https://default.registry/'
}))
// => configured registry: https://registry.npmjs.org
Install
$ npm install libnpmconfig
Contributing
The npm team enthusiastically welcomes contributions and project participation! There's a bunch of things you can do if you want to contribute! The Contributor Guide outlines the process for community interaction and contribution. Please don't hesitate to jump in if you'd like to, or even ask us questions if something isn't clear.
All participants and maintainers in this project are expected to follow the npm Code of Conduct, and just generally be excellent to each other.
Please refer to the Changelog for project history details, too.
Happy hacking!
API
> read(cliOpts, builtinOpts)
Reads configurations from the filesystem and the env and returns a figgy-pudding
object with the configuration values.
If cliOpts
is provided, it will be merged with the returned config pudding, shadowing any read values. These are intended as CLI-provided options. Do your own process.argv
parsing, though.
If builtinOpts.cwd
is provided, it will be used instead of process.cwd()
as the starting point for config searching.