NPM.ScopeRegistry (NPM v0.6.0)

Copy Markdown View Source

Resolve the registry URL for scoped packages.

npm supports per-scope registry configuration in .npmrc:

@mycompany:registry=https://npm.mycompany.com/

This allows private packages under @mycompany/* to resolve from a custom registry while other packages use the default.

Summary

Functions

Get all configured scope registries from .npmrc.

Get the registry URL for a package name.

Extract the scope from a scoped package name.

Check if a package name is scoped.

Functions

all_scopes()

@spec all_scopes() :: %{required(String.t()) => String.t()}

Get all configured scope registries from .npmrc.

Returns a map of scope => registry_url.

registry_for(name)

@spec registry_for(String.t()) :: String.t()

Get the registry URL for a package name.

Checks .npmrc for scope-specific registry configuration, falls back to the default registry.

scope(name)

@spec scope(String.t()) :: String.t() | nil

Extract the scope from a scoped package name.

Returns nil for unscoped packages.

scoped?(arg1)

@spec scoped?(String.t()) :: boolean()

Check if a package name is scoped.