Skip to content
Get the set npm registry URL
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.editorconfig ES2015ify and require Node.js 4 May 21, 2017
.gitattributes Require Node.js 6 May 27, 2018
.gitignore Require Node.js 6 May 27, 2018
.travis.yml
index.d.ts
index.js
index.test-d.ts Refactor TypeScript definition to CommonJS compatible export (#15) Apr 4, 2019
license
package.json 5.1.0 Apr 4, 2019
readme.md Require Node.js 6 May 27, 2018
test.js Require Node.js 8, add TypeScript definition (#14) Mar 11, 2019

readme.md

registry-url Build Status

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/'
const registryUrl = require('registry-url');

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

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

# .npmrc
@myco:registry = 'https://custom-registry.com/'
const registryUrl = require('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.

License

MIT © Sindre Sorhus

You can’t perform that action at this time.