-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
property - showdown
#935
Comments
3️⃣ or 4️⃣ 3 is a bit easier to implement from a package producer's standpoint. I'm leaning towards 3. |
This is so incredibly important to get right, because without this rule, I don't see a simple way of turning bower into a .. package manager. If you think about why npm is so powerful and useful, it is because each package has an entry file and doing something like If bower's main is a list of js/css/image files, then you cannot build a rich ecosystem of packages with deep dependencies or create tooling that makes This "one main js entry point per package" rule is independent of the module format (it would be a lot easier if we all agreed on one, of course). You can still author your modules in globals/AMD/CJS/ES6, but you should always have just one main entry point file and conversion between formats could be done via tooling (if possible in that particular case, otherwise you basically can't use that module, for example, I see potential problems with things like AMD plugins, or a global script that exports 5 variables to window). The main entry point doesn't mean there should only be one js file per package. You can do things like I would love if bower figured out a good way of managing CSS as well, but that's a tricky problem and for that I would also suggest creating a separate I don't see any point in listing images or other types of files in your I can see how this "what is a package in frontend world" problem is quite tricky, but my main beef with bower at the moment is that as package developer, I can barely depend on any other package in bower registry due to the spec being so loose. If I make a package with 2 dependencies that each have 2 other dependencies - I can push that to npm and know that it will work for everyone. If I push that to bower - chances are it will be a lot harder for the users to consume that package - the users will need to use a specific set of tooling that can wire those specific packages, or do the wiring manually by inspecting each package. Bower should enforce some kind of minimal set of rules about the structure of the package. Otherwise, I don't see it becoming more useful than manual script management or npm. Thanks for taking the time to read this ;) |
IMO, Component(1) gets this right: |
I can't see how this can be decided until the purpose of The purpose of Breaking the meaning of Fwiw, the term "single entry point" is misleading. "default entry point" is more accurate if we're following CJS/AMD.
In cujoJS, we allow developers to specify CSS dependencies in JavaScript ( Options 2️⃣ and 4️⃣ seem like interesting extensions to AMD/CJS Option 5️⃣ seems intractable. The definition of "feature" is way too loose. Let's take baby steps. My vote: 4️⃣a with a fallback to 1️⃣ if a string is provided (AMD/CJS).
|
Very much agree with @unscriptable ! |
@unscriptable's suggestion sounds right to me, too. Obviously, bower and npm (and other package.json-based tools) have different goals, but the established precedent of package.json's |
You don't need
Not sure what |
Changing the meaning of Since bower.json hasn't specified the purpose of I guess this technically isn't "breaking" the libraries. :) My bad. It's really just breaking convention and forcing us to continue to use a work-around (manual config). As long as the proposals still allow default id translation (without manual configuration), then I guess I'm cool with whatever is chosen. Can somebody help me understand how this might work if there are multiple values (i.e. in an array)? Just curious: have any of the browserify folks given their opinion? |
I'm the maintainer of sprockets, which is an asset build tool that has already implemented I really, really do not want to see this changed since we have existing implementations and Bower is supposed to be 1.0 at this point. However, I am in favor of introducing a new mapping property. I'm willing to implement such as thing for Sprockets once its figured out. |
I agree with @josh, we should be looking at introducing a new property to address the use case of multiple components. 2️⃣ |
I don't think there's much point to keeping a convention from another context if it doesn't fix this one. In browser-land not everything can be |
I agree. Though do note that Component(1) still has a I propose we keep We could then have a |
For the record, I agree with @sindresorhus. |
^^ @sindresorhus Yes. I like it. |
Yeah, I think this is the way to go. It would be doing what Component(1) does but nesting in a |
@sindresorhus how do you see that proposal working with a library like gallery-css? |
@benschwarz gallery-css wouldn't have a On 31 October 2013 13:58, Ben Schwarz notifications@github.com wrote:
|
@wibblymat sgtm! component style 😏 |
I don't like that, as I think it doesn't scale well. Why is I also don't like the idea to use E.g. I think Bootstrap should place and develop |
Looks like we've reached quorum on the Should we standardise it in the spec and come up with the design that we're most happy with for citing package |
Trying to turn this into something actionable in #963 |
I highly disagree with
as that essentially turns bower into "Another implementation of NPM" instead of "A package manager for the web". Packages for the web aren't always JS. In fact they could be things that have no JS at all like a css package (normalizecss) or an images pack or a font pack. I know this will get shot down pretty quick, but I propose dropping {
"components": {
"javascript": ["js/bootstrap.js"],
"css": [
"css/bootstrap.css",
"css/bootstrap-theme.css"
],
"font": [
"fonts/glyphicons-halflings-regular.eot",
"fonts/glyphicons-halflings-regular.svg",
"fonts/glyphicons-halflings-regular.ttf",
"fonts/glyphicons-halflings-regular.woff"
],
"image": [],
"audio": [],
"video": []
}
} The spec would have the supported types and if some other type wanted to be added, package authors could add their own custom (although build tools probably wouldn't support those). Build tools could still reference the main entry point as bower.components.js[0]. I'm hoping that this makes things clear for package developers, package consumers and build tools as you don't have to figure out what goes in main vs what goes in files and also slightly answers the question "Why Bower and not npm?" because it makes it clear that all web files are supported and treated equally instead of just JavaScript as npm does now. |
There's nothing to back up that conclusion. Component(1) also keeps
|
I was opting for
|
Why not {
"main": {
"javascript": ["bootstrap.js"]
},
"files": {
"css": ["bootstrap.css"]
}
} Personally I concur with @eddiemonge's general thought:
I realize that this all may seem verbose but I just kind of like the idea of thinking from the ground up vs trying to emulate all these backend-only solutions. |
^agree, file extension is sufficient information and makes bower much more flexible as it can support any file as long as the builder knows what do to with it. |
Trying to push this forward with some actual PRs to our spec. Please see the following and voice your opinions. |
I just like to link a use case of the |
Nowhere in this debate do I see a discussion about ingesting packages in production vs. development and which files are applicable to either of those environments. For example, this is why projects like bower-installer exist. Should we really have to use external tools for that? This seems like an extremely common use-case and something that could be specified in |
Scheduling this on 2.0.0 since this should be resolved one or other way in this release. |
I've changed my mind slightly after using wiredep for awhile. I think main should be an array of all files your module provides. Let the build tools figure out how to use those files. "main": [
"dist/jquery-ui.js",
"dist/jquery-ui.css",
"dist/jquery-ui.html"
] If a build tool wants to do something with a certain file type, it can parse the array and find (or not) what its looking for. |
@eddiemonge I think its safe to say that no one can agree to how this should work, nor what the syntax should be. I think the core team should get together and choose the proposal with the 'best' / 'most' merits and make … Then lock this issue forever. @bower/bower? |
👍 Ben. That's a great idea. I recommend something simple. |
Has supporting globs ever been part of this discussion? bower/spec#30 |
Happy 1 year 1 month anniversary of this important issue! |
I think we need to accept what main is de facto. It's one-per-module-system array that points to entry points of these module systems. Or string if only one module system is used. |
I've opened bower/spec#43 to implement sheerun's proposal and resolve this once and for all. |
We need to get this done. It's been more than half a year. Let's leave this for discussion and voting until the Bower meeting on the 3rd November (14 days). Then we should count up votes and pick a winner.
Resources:
main
property in component.json #59, Spec: Only be one file per type in the main array #63, Specification #110,main
property in bower.json #393, Docs - main property usage #263, bower.json main semantic #750Contenders:
Anywhere that there is an array we can obviously optionally allow a single string instead which means the same as a one-item array without introducing any ambiguity.
If you have a favorite option not listed here, let me know ASAP and I will include it.
//cc: @satazor @addyosmani @sindresorhus @paulirish @benschwarz @wycats @svnlto @desandro @necolas. Please ping anyone else who might have a strong opinion or interesting use-case.
The text was updated successfully, but these errors were encountered: