Crispen Smith
Crispen Smith

Reputation: 533

How to rename a component in installed with Bower

Given that bower support installing items that do not technically exist in the global bower namespace the following problem can arise.

Bower install https://github.com/bitovi/canjs.com/archive/v1.1.6.zip

results in

Components
|- v1.1.6
|--bower.json
|-- (complete installation of all required pieces here).

This can lead to potential confusion and maintenance problems down the road as it is now on the developer to recall that "can.js" lives in v1.1.6. Clearly there are fixes that one can implement (i.e. pointing all items using can.js to this directory) but this doesn't solve the core problem.

bower.json looks like this:

{
  "name": "v1.1.6",
  "main" : "",
  "version": "0.0.0",
  "repository": {
  "type": "asset",
  "url": "https://github.com/bitovi/canjs.com/archive/v1.1.6.zip"
 }
}

Is renaming the directory and updating the bower.json enough or is there another resource that needs to be updated as well?

Upvotes: 2

Views: 2001

Answers (1)

satazor
satazor

Reputation: 619

Yes updating bower.json is enough. In the next bower major release (1.0.0), you can name a package when installing. In your case you would so something like this:

bower install canjs=git://github.com/bitovi/canjs.com.git#~1.1.6

You can try out this new feature by installing bower-canary: npm install -g -f bower-canary

Upvotes: 4

Related Questions