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
Auto-sort bower.json dependencies alphabetically, fixes #1373 #1381
Auto-sort bower.json dependencies alphabetically, fixes #1373 #1381
Conversation
Maybe some helper function to avoid duplication? |
And make testing easier. |
@sheerun yes i know. but i don't have idea where in function. may i make helper function in Project.js |
Why not use deep-sort-object? Its works recursively but it doesnt really matter. If you use it, you have duplication solved and bower codebase stays the same. |
@satazor what's mean bower codebase? |
@satazor may i use this? https://github.com/IndigoUnited/node-deep-sort-object |
That's what he means :) |
I changed code that use deep-sort-object module for sorting. how about this? |
much nicer now :) |
Nope. I'm scheduling on 1.4.x |
1aa0cf2
to
0acfe55
Compare
0acfe55
to
f62aaa5
Compare
f62aaa5
to
252e915
Compare
252e915
to
6db5df9
Compare
6db5df9
to
78c49c2
Compare
78c49c2
to
91bc64c
Compare
This looks great! Scheduled for 1.4.2? 🎱 |
Yes. Thanks for reminding. |
Just find out that this new behavior is messing up the dependencies order. Sometimes the order matter. I am using bower with gulp in order to inject my dependencies into my app. |
The order of declaration shouldn't matter.. Maybe we can provide a flag |
Why shouldn't it matter ? It's sometime normal to have a specific loading order betweens libs. What if for example I'm using Colorbox which is a jQuery plugin and I load it before jQuery. It doesn't work. The best place to control order is to keep that order in the declaration array. Can you please provide a solution to that ? Until that this 1.5 update is a compatibility breaker. Thanks. |
I agree with @michgeek, order also matters in my app and I think disabling the auto sorting should be an option, even if by default the dependencies are ordered. |
@deonclem @michgeek JavaScript objects do not guarantee consistent key order. See http://stackoverflow.com/a/5525820/187954 |
@insanehong could you please update your PR with the latest from master? |
We've already deployed this feature in past, and reverted it because users complained. We need to put it behind a feature flag first.. |
@insanehong as per @sheerun's request, to be merged and deployed, this PR must:
|
@faceleg ok. I try make to new option for Auto-sort dependencies alphabetically |
Thanks for sticking with it @insanehong! |
Would be nice to have an option for this @insanehong :) |
Can you point me to those issues and complaints? I'm trying to understand why people would be against things being easier to read/parse. |
@fearphage Because they generated index.html with scripts in the same order as in bower.json |
This seems like a bad practice. At a minimum, it's suboptimal to tie your implementation to representation of data that you have no control over. If you want something to be in a certain order, you sort it. That's why we have methods for that. Ideally we shouldn't be coding based on the state we hope things are in. Is contract-less/wishful coding the only thing holding this back? Wouldn't a major version bump insulate bower from breaking anything that doesn't have |
It's more popular than you think. We can break it in major bump or a flag (even generic one, like |
Bower is deprecated and we don't want to release breaking changes now |
This patch fixed #1373.