-
Notifications
You must be signed in to change notification settings - Fork 140
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
files: list all required files for build tools #47
Comments
So the new "files" will hold all source files, and "main" will hold compiled versions again? |
With proposal 2 I think you have the potential to accept valid MIME types as the category list. By doing this, it's not up to you to figure out what kinds of files people need and you offload that to a different organization where it is getting close monitoring. Personally, I prefer proposal 2 as I feel there is more clarity which would be useful to users who are new or inexperienced with a project. |
Does this mean that the |
@alber70g It doesn't read that way to me — this would put them in a separate |
So we can expect half a year of wiredep not working and dependency mayhem... Nice. |
The second line implies that we should keep only ONE file per filetype in |
Who is The problem is that naive dependency resolvers like There are several kinds of information I would find useful from a package (property names aren't important here):
It may also be useful to offer different collections of files in the package that can be combined together with main as needed by the consumer (think various sizes, legacy support, languages): {
"main": [
"js/motion-base.js"
],
"options": {
"lite": [
"js/motion-lite.js"
],
"full": [
"js/motion-full.js"
],
"huge": [
"js/motion-huge.js"
],
"legacy": [
"js/motion-legacy.js"
]
}
} There would likely need to be some way for the consumer to specify which option(s) they want to be combined with I think this gives enough information for a consumer to take the
|
"files": {
"styles": {
"dist/css/bootstrap.css": "less/bootstrap.less",
"dist/css/bootstrap-theme.css": "less/theme.less"
}
} Other issues:
|
I think proposal 1 is better, build tools will easily adopt it I believe |
Proposal one works for wiredep 👍 I wouldn't vote for globs, however. It would just slow things down and the publisher should be able to explicitly list what files are important per release. They've been doing it with |
+1 for Option 1 Mime-types of Option 2 can be easily extracted automatically.. I'd go without globs, but with special behavior of npm:
|
@sheerun What becomes the purpose/use of |
@cvrebert It would be the same as
|
@sheerun Alrighty. @paulmillr Does Brunch have any thoughts about the proposals? |
I'm fine with globs. However... we should note what problems we want to solve here... and which not.
Do we answer these questions here or in a different place? I would like to solve real problems here. |
By the way, while we're at it, why don't we choose a more descriptive name, such as "sourceFiles" or "source". |
I've just read why you want I think Bower made mistake by encouraging to include only source files in That said, I think |
+1 for @sheerun, please do! |
Would this exclude Less files from |
@donaldpipowitch No, less can be library entry-point as well. If you use |
Okay, thanks. I asked because of this line in the pull request:
|
@calidion maybe a good idea to respect people and their ideas rather than posting what you just did. |
@calidion You're way off-base. None of that gives you a right to treat people like dirt. Seeing as an apology is unlikely forthcoming, I'm going to mute this issue. |
@benschwarz I apology for what i have said, but I hope as a base system, considering more on every changes you made, and what would be the subsequences for client projects. |
Just thought https://atom.io/docs/v1.0.3/hacking-atom-package-word-count#package-json might inspire you guys :) |
+1 for files with flat list As an aside - the changes to main also break this grunt task - https://github.com/yatskevich/grunt-bower-task - I think "files" is actually what this copy functionality needs rather than main. |
After letting things cool off for a while... 🐧 I think ditching this proposal and reverting |
As for me I'm convinced that listing only one file per extension in |
Technologies are like products, when they fit for demands, they will grow, otherwise, they will die. |
But breaking compatability is how new standards and best practices are made. To only look at the short term is short sightsighted and misses the big picture goals |
@kkirsche but what this boils down to is a naming convention preference. The |
@desandro Whilst it might be simple for bower to take this approach, those who utilise bower will have to deal with the breaking change in specification. It doesn't just affect the direct consumers of bower, but those who use components which use bower (think grunt/gulp tasks). This is mostly a pain because there's no good mechanism for communicating the new specification to all consumers. For me, Bower is a tool which allows devs to get on with the work that really matters to them... If any tool takes more effort to maintain than the primary goal, people just stop using the tool. This will be a real pain for CI builds. It took a long time to settle on a specification. Personally I feel it would be unwise to change it now rather than extend it as originally proposed in this post. |
Is there a reason to not just revert this change and re-release this version then do a major version bump to forcefully deprecate the old spec while moving to a new version with a new spec? I can only understand the frustration when there isn't a major version change. With one, sorry but breaking changes are the entire reason for major version numbers. |
Just to clear something up: we already changed
Thanks for this confirmation. Current Now I'm flip-flopping on my previous comment. " // use files field if there, otherwise fall back to main field
var files = manifestJson.files || manifestJson.main |
I was looking up to see if bower contained something similar to npm's file list to simplify my module (I'd rather be explicit with what I want included versus maintaining an ever growing list of ignores) which ended with my stumbling across this thread. This issue has been open since June and adding a files property would bring yet another thing of bower's to parity with npm; why wasn't that simply done and merged in? This is just a huge issue of arguments over using Just make a file list that includes everything that should be downloaded by bower. When a developer wants to use one file versus another, in their deployment scripts they can decide what is or isn't taken and that's it. That's how most other package managers do it and it's easy. The simpler the better. Besides the more parity with how npm works the easier bower/bower#1520 is to close (in one direction or another). |
npm's We could include it as well, but I don't like attaching it the meaning of "of all the files required to use the package". I especially don't like the idea of build tools using this list to select files to auto-require in project. If we introduce If wiredep wants to interpret this list as all files to include in project, I cannot stop them from doing so, but I think it's a wrong approach. It's better to extract dependencies with tools like webpack. How Additionally we'll make it clear Are you OK with it? |
But that's not what it means in the npm world; those are simply the files bundled with an npm install and nothing more. Yes some are required but not all. You typically pull down more files than what is required (documentation, sometimes examples, etc).
👍 ship it :). I'd work on the merge request but I'm unlikely to have time for a few more weeks (though if no one does it I'll certainly just do it). |
+1 for Proposal 2 |
@desandro after a year and a half has anything happened to this? |
It's a bit rude to link to that. While true, no reason to have to come off as a jerk about saying no. |
The reason I ask is I ended up in in a 20+ page rabbit hole to find this page with multiple different projects relying on each other's issues. I wouldn't have asked otherwise. |
@OmgImAlexis A year later, I'd say the recommended approach for developers is to use webpack to automatically discover assets that really need to be bundled. If you're package author, you can still use |
Since resolving
main
in #43, we've thrown a wrench in the gears for build tools, most prevelantly Wiredep. Wiredep needs a list of all the files to be included when you install the package. Previously,main
was being widely used for this purpose. Nowmain
should no longer lists all the files (The entry-point files necessary to use your package. One per filetype). We need another field.These two proposals are my first shot at it. Your thoughts appreciated 🍉
Proposal 1:
files
flat listMost likely you would list globs for multiple files of the same type.
Pros: Simple specification, easier for developers to adopt. Don't have to worry on Bower spec side about asset-type specification. Cons: Aside from file extension, it's not clear what files do what. For example, a package make require
icon.svg
— is this file a font or should be it used as an image?We leave it up to build tools on how they make use of the array. Some might only be concerned about
.js
and.css
files. For globs, they'd have to expand the glob and do the logic on their side.Proposal 2: asset-type object
Taking from #21
Pro: Clear about what files do what. Cons: More complex. We'd have to figure out the list of types. Might be confusing files that do not have an explicit type, like if there's a video file and we don't have a
videos
field.Fun fact: recommended way back in 2013 bower/bower#935 (comment)
files
would live along sidemain
, not overwrite it. I'm not sure if it should be required or part of thebower init
flow at this point.Currently, I prefer Proposal 1. Easier for authors and for Bower spec.
Related issues
The text was updated successfully, but these errors were encountered: