To proxy an external npm registry, you simply create a new Proxy Repository as documented in Section 6.2, “Managing Repositories” . Managing Repositories. The Provider has to be set to NPM . The Remote Storage Location has to be set to the URL of the remote repository you want to proxy. The official URL for the main npm registry is
To create a hosted repository with npm format, simply create a new Hosted Repository and set the Provider to
npm as documented in Section 6.2, “Managing Repositories” . Managing Repositories. A sample configuration for an internal releases npm hosted repository is displayed in Figure 16.2, “Example Configuration for a Private npm Registry”.
A repository group is the recommended way to expose all your npm registries repositories to your users, without needing any further client side configuration. A repository group allows you to expose the aggregated content of multiple repositories with one URL to npm and other tools. This is possible for npm repositories by creating a new Repository Group with the Provider set to npm as documented in Section 6.3, “Managing Repository Groups” Managing Repository Groups.
A typical, useful example would be to group the proxy repository that: proxies the npm registry, a npm, hosted repository with internal software packages and another npm, hosted repository with third-party packages. The configuration for such a setup is displayed in Figure 16.3, “An npm Group Combining the npm Registry and Two Private Registries”.
By default any anonymous user has read access to the repositories and repository groups. If desired, the repository manager can be configured to require authentication by adding
always-auth=true to the
.npmrc file and adding the encoded authentication details as documented in “Publishing Publishing npm Packages”Packages.
Publishing npm Packages
Publishing your own packages to a npm hosted repository allows you to share packages across your organization or with external partners.
When you publish the package, the user interface will contain a new folder with an @ preceding name of the scope. You can browse scoped packages from the Repository Path column. These packages are alphabetically indexed, in tree view, amid your repository’s overall list of packages.
Further details on scoping are available on the npm website.
Publishing requires authentication. It can be configured by adding an
_auth value to
.npmrc. The value has to be generated by base64-encoding the string of
username:password. You can create this encoded string with the command line call
openssl e.g.: for the default