• Home
Name
Date
Size
#Lines
LOC

..--

index.jsD12-May-2024228 76

licenseD12-May-20241.1 KiB2217

package.jsonD12-May-20241.6 KiB7372

readme.mdD12-May-20241.2 KiB5131

readme.md

1# registry-url [![Build Status](https://travis-ci.org/sindresorhus/registry-url.svg?branch=master)](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