-
Notifications
You must be signed in to change notification settings - Fork 12
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" vs "files" vs "ignore" #69
Comments
I'm still trying to do an in depth read of it, but is it like the 'files' in By the looks of some of these issues, I might be able to dramatically reduce the amount of code by leveraging more of the core bower package. It's been a while since I've looked at any of their new stuff. It shouldn't be hard to support this if the |
That was a quick reply. ;) Here some more indepth: We use svn. Now we want to manage our own assets/skins/themes in separate packages. And also use external packages like jquery, modernizr and many more via bower. We have repositories managed via "private bower" as our private "packagist" replacement. We do not really "publish" versions in tar balls. Instead we work on dev-branches and include them where needed in different projects still in developement. Some are even linked as svn externals. So now we try to find a way to get out theme-packages and its dependencies compiled (less) and combined and all images inside the css files into the "right" place. bower no longer likes globbing in "main". |
makes sense. Taking a look at the |
I owe you a pizza. :) Side note: var globmain = [
"**js/**.js",
"**css/**.css",
"**other/**.assets",
"**img/**.{png|gif|jpg|svg}"
];
var bowerfiles = require('bower-files')({
"overrides": {
"our-package-1": {
"main": globmain
},
[...],
"our-package-719": {
"main": globmain
}
}
}); |
ya, including "files" as an option would feel much cleaner. too many stars :) |
@eurosat7 Just an update, still looking into a clean solution. The |
Here was what I am up to [link deleted]. side note: I am also trying to follow composer require definitions as we run a mixed setup. |
Sweet :) If you can get that in a PR that would work with this version, that'd be great :) It's been a while since I've touched this code and my javascript style and libraries of choice have changed a lot. I'm considering a refactor with breaking changes, but I'd like to get this feature in before that. |
I am not allowed to code for PR at work. But please(!) : Feel free to rewrite and/or comment/document. |
Ya, there's a lot I don't like about they way I did this. I'm going to take a more functional approach in the future. Oh man, that's a rough work rule. Working for a company that leverages open source but isn't willing to contribute back always feels like bad mojo. I'll work on the refactor and try to get this in as soon as possible. Sorry for the delay! |
Feel free to contact me via mail. |
I might try wiredep or webpack in the next project. I looked at them some weeks ago and like their approaches. But for now legacy stuff is hindering me and I had to create an individual solution. Feel free to reject and close this issue if you think it's not part of this package after having a closer look. |
No, I still plan on adding this feature. It's just that the more I read about this "files" thing, the more I'm saddened that I didn't keep up. It sounds like they kind of stepped away from the "main" property as the canonical source of having a list of files. Although, even if I had kept up, I doubt that all bower packages would have updated accordingly. I'll work on this today |
@eurosat7 I have a pull request in that I'm planning on modifying based on your feedback. Basically, I added an option |
NICE :) Automatic switching between "main" and "files"? Should be optional. I would have done it a little more generic: So one could add custom properties for his own build tools or when the specifications change again. (default should stay But I would do it another way:
Anyway: Don't foget to have a test where you check for glob-support, which got forbidden lately for "main" but is still valid for "files": PS: stay cool, don't close the fridge. |
I like it! thanks for your suggestions. How about this? // This gets all files from the files property, then falls back to the 'main' property if the 'files'
// property doesn't exist, in that order
lib.fileListProps(['files', 'main']).files
// This gets all files from the files property, and the main property
lib.fileListProps(['files', 'main'], false).files With both of those, glob matching works, and it still only pulls out unique files, so if there is overlap between main and files, it only gets the unique files. |
Your comment on the second one is incomplete. But that aside: I'm happy with that. :) About the "ignore" - Properties: Are they applied as a filter by default or do you only apply them if the user does some |
Hmmm... I guess that's a good point about the ignore properties. Just so I'm clear, ignore properties should be applied after files, right? The "files" property can have glob matching, which is the reason you would want ignore? I guess another question is, if one of the file entries is a directory, should all of the files contained in that directory be included? Oh yes, and the other options you mentioned: I guess there may be a use case where you might want the contents of the other json files read, but for the most part you probably would only need that for a package or two that didn't fill out their |
2nd paragraph 1. topic 2nd paragraph 2. topic If you then want to also work on composer packages you will not have a So I thought it would be nice to widen up the scope of the tool. |
@eurosat7 Sorry it's been a while. I'll address the ignore piece today, and stick to globbing. As far as supporting multiple package formats, I think it would be difficult to accommodate all the different packages that don't comply with bower/component standards. Ultimately, accommodating multiple standards results in code bloat (of which bower-files is already victim of due to my poor design choices) and code poor maintainability, meaning I might be stuck using old standards for a while, which I guess I'm doing right now anyway... But for now, you can use the overrides options to fix up those pesky packages. I think I'm going to tackle the files/ignore properties for this PR, and attempt to catch this library up before adding more customization options. |
Alright, I've updated the pr to include a |
The default for ignoreListProps() being [] is ok, as long as "files" is not in the default for fileListProps(). I'll stay subscribed if you want to exchange ideas. Stay happy. ;) |
Yes, the "files" is not the default for this version, since that would be a breaking change. Using either of the new methods are opt-in. In the next major version of bower-files, the default will be spec compliant. I've got another bug to work in, but then I'll publish a new version this week. |
@eurosat7 After all this time, I've finally pushed out the change to 3.14.1. Let me know if you have any issues with these changes. |
HI!
Due to
bower/spec#43
and
bower/spec#47 #Proposal 1: files flat list
I would like to use "files" and/or "ignore" in addition to "main" in the bower.json of required packages to find my assets.
Just an example:
And/Or:
What do you think?
The text was updated successfully, but these errors were encountered: