As Node.js is becoming a mainstream technology in the enterprise, more companies are asking for a private npm registry solution for their proprietary closed-source modules.
While there are several solutions emerging that offer a private npm registry server (either in the cloud or on premise), we at StrongLoop feel the private registry server is only one part of the story.
The second part is switching your npm client configuration between multiple registries. Why would you want to use multiple registries? There are several reasons; for example:
Previously, many developers used the npm config command to switch between different registry servers:
$ npm config set registry <a href="https://your.registry.url/">https://your.registry.url/</a>
This solution has few drawbacks:
The module npmrc provides a better solution. It maintains a set of npmrc files (one npmrc for every registry) and you switch between them using a single command. However it is still not perfect, as the general options like “browser” or “git” are not shared across different configurations as they should be.
Introducing slc registry
Today we are pleased to announce a new tool that makes registry switching as easy at it should be: “slc registry”. It comes as a part of “slc”, our Swiss-army knife for Node.js developers.
slc registry quickstart
1 . Update your slc tool
$ slc update
or install it from the public npmjs.org registry
$ npm install -g strong-cli
2 . Add a new configuration entry for your private registry
$ slc registry add private <a href="http://your.registry.url/">http://your.registry.url/</a>
You will be presented with a simple wizard where you can customize related configuration options:
Adding a new configuration "private" [?] Registry URL: (http://your.registry.url/)
[?] HTTP proxy:
[?] HTTPS proxy:
[?] Email: (email@example.com)
[?] Always authenticate? (Y/n)
[?] Check validity of server SSL certificates? (Y/n)
Configuration "private" was created.
Run `slc registry use "private"` to let the npm client use this registry.
3 . Switch your npm client to use the private registry:
$ slc registry use private
Using the registry "private" (<a href="http://your.registry.url/">http://your.registry.url/</a>).
4 . Switching back to the public npmjs.org registry is easy too:
$ slc registry use default
Using the registry "default" (<a href="https://registry.npmjs.org/">https://registry.npmjs.org/</a>).