Why not auto-detect NPM registry from .npmrc?
See original GitHub issueI see in discussion from #16 that the OP wanted to install dependencies in a package from a private registry, and the subsequent support for that through the --registry
option.
My question is, why does install-peerdeps
not work alongside npm
(or yarn
) by using settings that are already set in ~/.npmrc
(or ~/.yarnrc
), especially with respect to use of a private NPM registry.
For example, I have published eslint-config-myconfig
in my private registry, the URL of which I’ve configured in my ~/.npmrc
file. So, if I run this command to query the package’s peer dependencies:
$ npm info eslint-config-myconfig peerDependencies --json
{
"@typescript-eslint/eslint-plugin": ">=2.21 <3",
"@typescript-eslint/parser": ">=2.21 <3",
"eslint": ">=6.8 <7",
"eslint-config-airbnb-typescript": ">=7 <8",
"eslint-config-prettier": ">=6.10 <7",
"eslint-plugin-import": ">=2.20 <3",
"eslint-plugin-prettier": ">=3.1 <4",
"eslint-plugin-security": ">=1.4 <2",
"prettier": ">=1.19 <2",
"typescript": ">=3.8 <4"
}
It just works!
The same should be true when it comes to installing those peer dependencies. When spawning a child process to run npm
(or yarn
), just let the underlying package manager read its own configuration file.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:2
- Comments:10 (5 by maintainers)
I’ll take a look at branching this and see what I come up.
It could certainly shell out to npm config get registry.