Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

main should only contain filename(s), not directories, right? #19

Closed
cvrebert opened this issue Feb 21, 2014 · 9 comments
Closed

main should only contain filename(s), not directories, right? #19

cvrebert opened this issue Feb 21, 2014 · 9 comments

Comments

@cvrebert
Copy link
Contributor

Just making absolutely sure. See twbs/bootstrap#12805
(And yes, I know it should really be only 1 file (bower/bower#946), but it's been 3 months and files still has yet to been added to your spec.)

@josh
Copy link
Contributor

josh commented Feb 21, 2014

Correct, main must never be a directory.

@unscriptable
Copy link

Hey guys,

I love bower! But I'm concerned that it increasingly seems to only want to handle non-modular libs. This issue seems to be a good example.

Specifically, how does a modular library define its selection (i.e. folders) of available modules and define which one of these modules is the "main module"? mout doesn't have a main module, but most other libs do. In modular environments (node, AMD), the main module must be explicit if it's not the default (index or main) and most libs don't use the default.

In npm, this is solved by package.json's "main" property. This property indicates the main module and anything not explicitly ignored is copied into the local application. How do we do this with bower? How do we indicate which files should be copied and which one is the main module?

Thanks!

@josh
Copy link
Contributor

josh commented Feb 21, 2014

@unscriptable see #9.

@unscriptable
Copy link

BOOM. subscribed to #9. Thanks @josh!

@cvrebert
Copy link
Contributor Author

Correct, main must never be a directory.

Is that actually enforced anywhere?
Also, came across yeoman/bower-requirejs#66 while searching, which increased my uncertainty.

@unscriptable
Copy link

I don't see how #9 is a scalable solution, tbh. :(

@robdodson
Copy link

@cvrebert re: bower-requirejs, we added directory support as a crappy stop gap until moduleType landed. Now that moduleType is in, we're working on adding CommonJS package support. In the future it might make sense for us to throw a warning, instead of building a path to a dir.

@zgardner
Copy link

The docs for main say it represents:

 The primary acting files necessary to use your package.

It then states that it can be used by build tools.

In Bootstrap's case, it's true that bootstrap.js, bootstrap.css, and the fonts are the primary acting files.
Bootstrap needs to either:

1) Indicate that boostrap.js goes in js/bootstrap.js, bootstrap.css goes in css/bootstrap.css, etc.
2) Have bower's main be bootstrap_bower.js, bootstrap_bower.css, etc.
3) Not use bower's main.

I think the first option is preferable.
The paths suggestion would provide a mechanism to do that.

Right now, repos must have non-flat versions of files and flat versions of files just for Bower.
I don't think is the right way to go.

@josh
Copy link
Contributor

josh commented Feb 23, 2014

Bootstrap current main directive in bower.json looks reasonable to me.

"main": [
    "./dist/css/bootstrap.css",
    "./dist/js/bootstrap.js",
    "./dist/fonts/glyphicons-halflings-regular.eot",
    "./dist/fonts/glyphicons-halflings-regular.svg",
    "./dist/fonts/glyphicons-halflings-regular.ttf",
    "./dist/fonts/glyphicons-halflings-regular.woff"
  ]

All the files exist and there aren't multiple files per extension in the array. Theres only one css, js, etc.

The only thing old about it is the font set. I might suggest that those be packaged as their own bower repository as glyphicons and glyphicons be defined as a dependency of twitter bootstrap.

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

No branches or pull requests

5 participants