How Bower Works with Local and Remote Repositories

How Bower Works with Local and Remote Repositories

AuthorFullName__c
JFrog Support
articleNumber
000001367
ft:sourceType
Salesforce
FirstPublishedDate
2016-10-06T13:35:40Z
lastModifiedDate
2024-03-10T07:48:56Z
VersionNumber
8

When deploying an artifact to a local, Bower-declared repository, Artifactory will extract from the bower.json file the artifact's name and version information, and add them as properties to your package (with the properties being called bower.name and bower.version):

User-added image

Thereafter, when you try to resolve this package from Artifactory using the Bower install command, Artifactory will search for those parameters using the properties search. After finding a package with the matching parameters, Artifactory will send that package to the client. If one of those parameters is missing, Artifactory will be unable to retrieve the package.

When using a remote repository, the resolution behaves differently. When resolving a package, by default, Bower will go to the Bower registry to discover where the package being sought is registered. The Bower registry will return its result to the Bower client with information referencing the location from where the package can be resolved. Thereafter, Bower will try to resolve the artifacts using the results it has received. When using the bower-art-resolver, as Bower first tries to reach the Bower registry, it will access Artifactory, which will then access the Bower registry to receive reference information related to downloading the package. Artifactory will search for this information in the gitrefs file, which can be found inside each package path, as follows:

User-added image 

Then Artifactory downloads the desired package and returns it to the client. The gitrefs file contains all versions available for this package (i.e., the information within the file constructed from the tags that are available for this specific package). By default, a file of this type will expire every 7200 seconds . You can adjust this time period to be shorter by navigating to the remote repository's Configuration > Advanced > Metadata Retrieval Cache Period. So long as this file has not expired, then Artifactory will serve its already-cached artifacts. If the file has expired, then Artifactory will try to resolve the file from the Internet.

 

Published: May 21, 2017

Last updated: Jan 24, 2021

 

Keywords: Bower remote repository, Bower local repository, gitrefs