Name |
Date |
Size |
#Lines |
LOC |
||
---|---|---|---|---|---|---|
.. | - | - | ||||
index.js | D | 12-May-2024 | 228 | 7 | 6 | |
license | D | 12-May-2024 | 1.1 KiB | 22 | 17 | |
package.json | D | 12-May-2024 | 1.6 KiB | 73 | 72 | |
readme.md | D | 12-May-2024 | 1.2 KiB | 51 | 31 |
readme.md
1# registry-url [](https://travis-ci.org/sindresorhus/registry-url) 2 3> Get the set npm registry URL 4 5It's usually `https://registry.npmjs.org/`, but [configurable](https://www.npmjs.org/doc/misc/npm-config.html#registry). 6 7Use this if you do anything with the npm registry as users will expect it to use their configured registry. 8 9 10## Install 11 12``` 13$ npm install --save registry-url 14``` 15 16 17## Usage 18 19```ini 20# .npmrc 21registry = 'https://custom-registry.com/' 22``` 23 24```js 25const registryUrl = require('registry-url'); 26 27console.log(registryUrl()); 28//=> 'https://custom-registry.com/' 29``` 30 31It can also retrieve the registry URL associated with an [npm scope](https://docs.npmjs.com/misc/scope). 32 33```ini 34# .npmrc 35@myco:registry = 'https://custom-registry.com/' 36``` 37 38```js 39const registryUrl = require('registry-url'); 40 41console.log(registryUrl('@myco')); 42//=> 'https://custom-registry.com/' 43``` 44 45If the provided scope is not in the user's `.npmrc` file, then `registry-url` will check for the existence of `registry`, or if that's not set, fallback to the default npm registry. 46 47 48## License 49 50MIT © [Sindre Sorhus](http://sindresorhus.com) 51