registry-url
TypeScript icon, indicating that this package has built-in type declarations

7.2.0 • Public • Published

registry-url

Get the set npm registry URL

It's usually https://registry.npmjs.org/, but it's configurable.

Use this if you do anything with the npm registry as users will expect it to use their configured registry.

Install

npm install registry-url

Usage

# .npmrc
registry = 'https://custom-registry.com/'
import registryUrl, {defaultUrl} from 'registry-url';

console.log(registryUrl());
//=> 'https://custom-registry.com/'

console.log(defaultUrl);
//=> 'https://registry.npmjs.org/'

It can also retrieve the registry URL associated with an npm scope.

# .npmrc
@myco:registry = 'https://custom-registry.com/'
import registryUrl from 'registry-url';

console.log(registryUrl('@myco'));
//=> 'https://custom-registry.com/'

If 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.

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
7.2.0333latest

Version History

VersionDownloads (Last 7 Days)Published
7.2.0333
7.1.012
7.0.014
6.0.12,230,979
6.0.0448
5.1.04,735,450
5.0.092
4.0.05,955
3.1.04,034,194
3.0.3170
3.0.214
3.0.12
3.0.03
2.1.014
2.0.02
1.0.04
0.1.114,004
0.1.02

Package Sidebar

Install

npm i registry-url

Weekly Downloads

11,021,692

Version

7.2.0

License

MIT

Unpacked Size

5.01 kB

Total Files

5

Last publish

Collaborators

  • sindresorhus