Stepan Tuhacek
Stepan Tuhacek

Reputation: 218

How to set relative file path in bower dependency

I want to import my custom version of javaScript library to project. To add custom library, I had to create bower project, create new local GIT repository and install it. Like this: bower install

bower.json

{
  "name": "project",
  "description": "proj desc",
  "main": "index.js",
  "dependencies": {
    "custom_ammaps3": "C:/work/project/git/ui/lib/custom_ammap3/.git#master"
  },
}

It works. But now I want to commit it to project git, so anyone could install and use it, so I need to place the relative path there. But when I delete the part C:/work/project/git/ui/ and there is just part "custom_ammaps3": "lib/custom_ammap3/.git#master" it fails with error saying that it is not the repository. When this path starts with / it reads from GIT_HOME directory, so I can't use that neither.

Upvotes: 0

Views: 882

Answers (1)

giorgio
giorgio

Reputation: 10202

That is because you are referencing a local git repo, which can only be reached by you, or anyone having access to your computer. So basically you are the only one who can use this package.

You have two options: make your project dependent on the non-customized library, and change anything you need with hooks, events or configuration provided by the library you are using. This is the preferable way to go, because you don't break anything.

And if you want to alter core code itself; fork! Or just download and alter the code, although a fork would be preferable because if your changes are good you can send a pull-request to the original coder.

Upvotes: 1

Related Questions