How to Setup Private-Bower having Source code on GitLab with Artifactory (Sample walk-through)

Please use following steps to setup Private-Bower having Source code on GitLab with Artifactory.

STEP 1 – Install Private-bower: 

Please refer to https://www.npmjs.com/package/private-bower to install private-bower.
Run Private-bower which will look like below.

Add Packages in private-bower using GUI.
STEP 2 – Configure Artifactory:

1. Login as admin.
2. Create two remote repositories and one virtual repository.
  • public bower repository
  • private bower repository
  • virtual bower repository
STEP 2-1 – Let’s create public one first:
Go to Admin tab -> Remote -> New -> Bower -> select setting as shown in screenshot then save it.

STEP 2-2 – Now let’s create  private one:

Go to Admin tab -> Remote -> New -> Bower -> select setting as shown in screenshot then save it.

  • Change URL from https://github.com/ to your GitLab URL.
  • Change Git Provider from GitHub to Custom.
  • Change Download URL to “{0}/{1}/repository/archive.{3}?ref={2}” .
  • Change Registry URL  from https://bower.herokuapp.com to your private-bower url (for example http://10.60.1.94:5678/)
  • Save it.

STEP 2-3 – Create Virtual Repository:

Go to Admin tab -> Virtual -> New -> Bower

Select both previously created bower-remote-public and bower-remote-private as included repositories. Then Save it.

STEP 3 – Configure Bower to use virtual-remote-bower repository:

Click on Artifacts -> virtual-remote-bower (from Artifactory Repository Browser) -> Click on Set Me Up follow steps provided in Set Me Up

npm install -g bower-art-resolver

Now replace the default Bower registry with the following in your .bowerrc file: 

{   "registry" : "http://10.60.1.94:8081/artifactory/api/bower/virtual-remote-bower",   "resolvers" : [      "bower-art-resolver"   ]}

 

STEP 4 – Finally now try: 

bower install bower-gitlab-demo

and try

bower install angular