registry-url

Get the set npm registry URL

MIT 18 个版本
安装
npm install registry-url
yarn add registry-url
pnpm add registry-url
bun add registry-url
README

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.

版本列表
7.2.0 2025-04-15
7.1.0 2025-04-10
7.0.0 2025-04-03
6.0.1 2022-06-22
6.0.0 2021-04-17
5.1.0 2019-04-04
5.0.0 2019-03-11
4.0.0 2018-05-27
3.1.0 2016-04-04
3.0.3 2015-04-07
3.0.2 2015-03-31
3.0.1 2015-03-30
3.0.0 2015-02-23
2.1.0 2015-01-18
2.0.0 2014-10-10
1.0.0 2014-08-13
0.1.1 2014-07-09
0.1.0 2014-06-15