How to setup a private bower repository with SVN support



This tutorial shows you how to setup a private bower repository with SVN support.

We will use the nodejs package private-bower to achieve this goal.

Requirements:

  • A server which has nodejs installed.

Of course you can use your development machine for initial testing and “one-person” projects.

Steps:

  1. Setup the server
  2. Configure your bower package to publish to the private repository
  3. Configure bower in your consuming project(s) to fetch packages through private repository

1. Setup the server

On the server create a folder to install private-bower.
In this folder execute the command:

Once the package is installed, you can start the repository:

Your server is ready!
You can access the web UI on http://localhost:5678.

At this point we use the default configuration of the bower repository server.
There are a number of settings which you can specify, but normally the default will do.

2. Configure your bower package to publish to the private repository

Now we need to adjust our project which we want to publish to our private bower repository. Else we will publish to the public bower repository.
You need to adjust the .bowerrc file which is located in the root folder of your project.
If it does not exist yet, you need to create it.
Put this content in the file:
(replace [server_hostname] with the host name of the server you installed private-bower upon)

(If you want to use this registry for all your projects, you can add this setting to your global bowerrc file.)

You should now be able to register your package to the private bower repository:

Yes: private-bower supports SVN as a source repository!

Examples:

Notice the logging on the private-bower server.

  • If the bower package is stored in a SVN repository, you need to use svn:// or svn+http:// as protocol.
  • In that case you will also need SVN to be installed on your system. You can use tools such as SlikSVN or TortoiseSVN (1.7 or above)

3. Configure bower in your consuming project(s) to fetch packages through private repository

Finally we need to adjust our consuming project(s) in order to fetch the packages from the private bower repository. Else we will query the public bower repository.

You need to adjust the .bowerrc file which is located in the root folder of your project.
If it does not exist yet, you need to create it.
Put this content in the file:
(replace [server_hostname] with the host name of the server you installed private-bower upon)

(If you want to use this registry for all your projects, you can add this setting to your global bowerrc file.)

You should now be able to fetch your package from the private bower repository with the basic bower install command.

  • If the bower package is stored in a SVN repository, you will also need SVN to be installed on your system. You can use tools such as SlikSVN or TortoiseSVN (1.7 or above)