Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

readme.md 1.2KB

il y a 4 ans
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. # registry-url [![Build Status](https://travis-ci.org/sindresorhus/registry-url.svg?branch=master)](https://travis-ci.org/sindresorhus/registry-url)
  2. > Get the set npm registry URL
  3. It's usually `https://registry.npmjs.org/`, but it's [configurable](https://docs.npmjs.com/misc/registry).
  4. Use this if you do anything with the npm registry as users will expect it to use their configured registry.
  5. ## Install
  6. ```
  7. $ npm install registry-url
  8. ```
  9. ## Usage
  10. ```ini
  11. # .npmrc
  12. registry = 'https://custom-registry.com/'
  13. ```
  14. ```js
  15. const registryUrl = require('registry-url');
  16. console.log(registryUrl());
  17. //=> 'https://custom-registry.com/'
  18. ```
  19. It can also retrieve the registry URL associated with an [npm scope](https://docs.npmjs.com/misc/scope).
  20. ```ini
  21. # .npmrc
  22. @myco:registry = 'https://custom-registry.com/'
  23. ```
  24. ```js
  25. const registryUrl = require('registry-url');
  26. console.log(registryUrl('@myco'));
  27. //=> 'https://custom-registry.com/'
  28. ```
  29. 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.
  30. ## License
  31. MIT © [Sindre Sorhus](https://sindresorhus.com)