Skip to content
This repository has been archived by the owner on May 29, 2019. It is now read-only.

Register with Bower/Yeoman #56

Closed
seanpdoyle opened this issue Jan 7, 2013 · 25 comments
Closed

Register with Bower/Yeoman #56

seanpdoyle opened this issue Jan 7, 2013 · 25 comments

Comments

@seanpdoyle
Copy link

I would love to use this library in my Yeoman project, but it's not registered with Twitter Bower, so I can't yeoman install it for all the benefits that come with package management.

I'm not sure what steps are necessary in order to convert the package.json into a component.json without creating a maintainence nightmare. Maybe it would be possible to double-dip the file (I'm not sure about the current state of the Bower naming convention), since the yeoman-angular generator currently scaffolds projects with a package.json file.

@pkozlowski-opensource
Copy link
Member

@seanpdoyle Supporting Bower is definitively on our road-map. We were even toying with the idea of having a separate Bower artifact for each directive so people can pick & choose what they need and install only required parts.

That being said we are trying to do the very first release (0.1.0) and focusing on directives at the moment. It would be absolutely, totally awesome if you could give us a hand with Bower. Not sure what is missing in the current npm package but a pull request fixing things would be highly appreciated.

In any case I'm keeping this open as Bower is something we would like to support.

@seanpdoyle
Copy link
Author

I'd love to help.

From what I've seen, there are only minor differences between the fields in component.json and package.json. I know that component.json files have a

{
  ...
  "main": ["path/to/css/style.css", "path/to/js/app.js"],
  ...
}

field, not sure if that's in a node package.json. I think they're similar so enough that I've seen projects include a component.json as a symbolic link to package.json.

The only thing that I need from you guys is the name you'd like to use in the bower register <angular-ui-bootstrap?> git://github.com/angular-ui/bootstrap command.

@fat correct me if I'm wrong?

@pkozlowski-opensource
Copy link
Member

@seanpdoyle Awesome, thnx for offering help!

Regarding the name I think that angularjs-bootstrap would be OK. We are under the angular-ui umbrella but don't have any dependency on angular-ui in terms of code.

The only thing where I'm not clear is how Bower will find our build files. We are publishing deliverables to the gh-pages branch only, build files are not checked in. Not sure how this would work.

You know, let me read up on Bower a bit. Then I will come back to you and we will see how to proceed.

Once again, thnx for offering help here, much appreciated!

@seanpdoyle
Copy link
Author

I think bower currently does a full git checkout of the tag that corresponds to the version field in the component.json or package.json when installing a package. If there are no valid semantic version tags that correspond to the version number, there are problems.

Not sure if its an issue, but Bower registration is on a first-come first-served basis, so registering a package sooner rather than later could be a plus. A competing package angular-strap is already registered as such, so you might not have any competitors for the angular-ui-bootstrap namespace.

If your gh-pages branch contains all the built code, maybe it would be as simple as including a component.json in that branch, tagging it with a valid semantic version number, and registering the package to with that branch.

@fat is it possible to register a branch other than master? Can a git:// URI point to a branch other than master?

If not, and the repo doesn't contain any of the built/optimized files, the package could still function. The onus would be on the user to include the directive js files by hand. This could be acceptable for the time being, and could be figured out in future releases.

@pkozlowski-opensource
Copy link
Member

Alternatively we could simply register from a URL as all the build and optimized files are published as github pages. So, for example the latest version of build files is available at:

http://angular-ui.github.com/bootstrap/ui-bootstrap-tpls-0.1.0-SNAPSHOT.min.js

As for the "competing package" - we are not competing really :-) I mean, even if both projects are building bootstrap-specific directives the underlying philosophy is rather different (wrapping existing JavaScript vs. native directives). Anyway, I agree that securing a name is probably a good move.

We just need to check what about registering things from a branch (gh-pages).

@seanpdoyle
Copy link
Author

Alternatively we could simply register from a URL as all the build and optimized files are published as github pages. >So, for example the latest version of build files is available at:

http://angular-ui.github.com/bootstrap/ui-bootstrap-tpls-0.1.0-SNAPSHOT.min.js

I think the registered URL has to be a git:// one.

@pkozlowski-opensource
Copy link
Member

Ah, OK, so you can install a URL but not register package of the URL. Kind of make sense since from what I can see Bower is using tag names to denote versions, right? The problem is that we need to tag sources as well...

I don't know, at the end of the day we could simply keep generated files checked-in in the source tree, but this is a bit of pain in a neck. Otherwise we could create a separate repository for Bower....

As I've said (and as you can see!) I need to understand more about Bower :-)

@seanpdoyle
Copy link
Author

In order to install your package, I would change my project's `component.json' to include

{
  ...
  "dependencies": {
    "angular-ui-bootstrap": "~0.1.0"
  }
  ...
}

then, from the command line, run bower install (or, in my case yeoman install, which currently just calls bower).

Next, the git repo you register (i.e. bower register angular-ui-bootstrap git://github.com/angular-ui/bootstrap unless we can somehow incorporate the gh-pages branch into the URI) would be cloned and included in my project (in my case, in my app/components directory).

At this point, it would be up to me as a user to properly include app/components/angular-ui-bootstrap/ui-bootstrap-0.1.0-SNAPSHOT.min.js in my index.html's <script> tags.

If the git URI can't incorporate the gh-pages (i.e. distro) branch, maybe a separate angular-ui/bootstrap-bower repo could be created and updated with some sort of git hook whenever gh-pages gets pushed. That way, you could bower register angular-ui-bootstrap git://github.com/angular-ui/bootstrap-bower instead. If this is the case, you should hold off on registering until this repo is created, since it seems like there is no way to unregister a package yourself.

@seanpdoyle
Copy link
Author

Any updates on this?

@pkozlowski-opensource
Copy link
Member

Sorry @seanpdoyle, we are busy getting 0.1.0 out of the doors... and internally discussing directives split between this repo and the main angular-ui repo. In the short term we are probably going to create a separate repo as I couldn't find of instructing Bower to work off the gh-pages branch.

But for now the focus is on the very first release, we've just got 3 or so bugs to fix before this happens.

@mpaulucci
Copy link

+1 for this. Currently the project is on Bower but it would be nice to have the builds.

Thanks!

@joshdmiller
Copy link
Contributor

I'm not sure how this works. Our builds are kept on the gh-pages branch,
but as far as I am aware, Bower only lets you register the master branch.

With jquery projects this is mostly irrelevant, but this will be
increasingly problematic for AngularJS projects.

Are there any Bower experts out there who can shed some light?
On Feb 21, 2013 9:22 AM, "Martin Paulucci" notifications@github.com wrote:

+1 for this. Currently the project is on Bower but it would be nice to
have the builds.

Thanks!


Reply to this email directly or view it on GitHubhttps://github.com//issues/56#issuecomment-13901137.

@pkozlowski-opensource
Copy link
Member

@joshdmiller you are right, there was a lengthy discussion about it.

For now I don't see any other option as creating a dedicated repo and checking-in build files in this repo after each release. This is what AngularJS is doing BTW: https://github.com/angular/bower-angular, https://github.com/angular/bower-angular-resource etc. I think we should do the same unless anyone has a better idea.

At the same it might be good to register this repo as well so people can depend on individual directives (but I'm not sure if this won't create more confusion than good).

BTW, this is one of the items I want to discuss during the hangout.

@pkozlowski-opensource
Copy link
Member

Had another look at the bower registration and it looks like our repo was registered already:

bower search angular
Search results:

  • angular git://github.com/angular/bower-angular.git
  • angular-ui git://github.com/angular-ui/angular-ui.git
  • angular-strap git://github.com/mgcrea/angular-strap.git
  • angular-bootstrap git://github.com/angular-ui/bootstrap

which is a bit unfortunate if we want to have a dedicated repository for build files (bootstrap-bower).

Should we register it under a different name (angular-bootstrap-all?) or change this in Bower (I believe that this is manual process atm). Thoughts?

@vvakame
Copy link

vvakame commented Feb 23, 2013

👍

@agadzik
Copy link

agadzik commented Feb 25, 2013

@pkozlowski-opensource If it's easier, I would change what is already registered in Bower so there's no confusion going forward on which is the correct package to install.

@nXqd
Copy link

nXqd commented Feb 28, 2013

👍

@halkeye
Copy link

halkeye commented Feb 28, 2013

#116 also has a few component.json additions to ignore certain files.

Looks like another solution to the gh-pages problem is to include the copies of the files in a dist/ directory and then ignore them with component.json directives. That doesn't seem like an ideal solution either.

Edit: according to bower/bower#8 you should be able to tag your gh-pages with version numbers and bower will use that instead.

@icholy
Copy link

icholy commented Mar 4, 2013

👍

@pkozlowski-opensource
Copy link
Member

OK, so after longish discussion (including ones with the Bower team) it seems like the the best option for now is to create a separate repository and store in there build files.

So, I went ahead and created the https://github.com/angular-ui/bootstrap-bower repository and pushed + tagged all the released files.

I've also asked Bower guys to change the angular-bootstrap pointer to the new repository. This process is manual and cumbersome for the moment: bower/bower#120

Will keep this issue open till the repo pointer change.

@pkozlowski-opensource
Copy link
Member

FINALLY!!! All the issues are sorted out now and we can install this awesome library via:

bower install angular-bootstrap

Windows users, be warned: http://wingkaiwan.com/2012/11/25/bower-errors-on-windows/

@chicoxyzzy
Copy link
Contributor

I need bower package that contains all files of bootstrap to be able to choose distinct directives. How can I get just dropdownToggle.js for example? Can you register angular-bootstrap-full or something like that?

@pkozlowski-opensource
Copy link
Member

@chicoxyzzy Actually I thought about this but didn't do this initially as not to confuse people (I can see people wondering which package they should be using...).

Please open another issue if you believe that having a bower component with individual directives would be useful, please open another issue so your request is not lost.

@chicoxyzzy
Copy link
Contributor

@pkozlowski-opensource done #255

@jeffwesson
Copy link

I ♥ the Internet.

Just before saving the raw angular-bootstrap I thought, "damn, I wonder if I can get this through bower...?"
Enter google and this great issue thread: in just three months time, the community went from "I'd also like that!" to bower install angular-bootstrap 👍

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests