-
-
Notifications
You must be signed in to change notification settings - Fork 6.9k
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
Bower package manager instead of Packagist for jQuery #2965
Conversation
jQuery is package is now fetched from Bower via bowerphp and loaded from bower_components directory. post-scripts are now in place to perform bower update/install after relevant composer command is issued.
travis failed due to improper location of jquery asset, it has been fixed in 6d48bb4 |
it will re-run the test. travis is just a bit slow these days. |
What if there is a js package that requires a specific yii version, does it install yii two times then? |
I am not sure what you mean exactly there, composer is something separate from bower. Composer behavior is not changed in this PR (except that it calls bower install/update automatically after such action). |
The problem here is that what I already said in #2946 (comment) it is not good to mix these worlds. |
@cebe you bring up a valid point, it should discussed at composer level as well. However what happens if two extensions require different versions of jquery, how would this be handled? It is wise to require a specific version application-wise imho. Btw, I added a proper |
I don't know if it is helpful or not, but perhaps we could instruct bower to use {
"directory": "vendor"
} |
@pmoust I don't want to waste your time, but as explained in #2946 (comment), we are not going to use bower to manage jquery dependency. It just creates unnecessary complexity (the extra bower installation, the new |
No problem. |
Just checking something on Travis. |
I like these changes. I think we need to reconsider its usage. |
It seems you've enforced jQueryUI dependency on framework. It should not be downloaded if jui package isn't used. |
You are right, moving it to jui package. |
yii2-dev is fine but yii2 should not include it. |
Are hooks called for dependent packages and not only the main pacakge? |
@samdark how would you like the hooks to be called? I would prefer to not even have hooks but introduce bower to be honest. For jui package I would suggest adding a bower.json with the dependency, and be called from there. I could automate that for all the packages that have a bower.json I suppose. I could even introduce a static method to be called from within Yii as helper to run bowerphp if you think it is crucial. |
We'll not bundle jQuery or jQueryUI with the framework itself or with any of framework extensions. Current state of jQueryUI files is temporary. |
There will be 2 automatically updated mirrors with composer pacakges: https://github.com/yiisoft/jquery and alike https://github.com/yiisoft/jqueryui that isn't set up yet. These are updated automatically and not taking our time if this is concern. |
Well @dmtrs has argued about that in #2946 (comment) I don't have much to add to that. Since you are in the FIG and know a few people, perhaps point them to this thread to bring it down to Composer, see if they can figure it out at their own level. I would be more content if you accepted this PR, but no hard feelings, we can live without it as well. |
@pmoust that argumentation doesn't affect technical aspect of the framework itself. Framework would work by default w/o bower just fine. If one want to use bower in his app, there are no obstacles to do it at all. So it's not about technical aspect all. It's about if we want to force usage of bower or not. |
I can say that PHP-FIG discussion will result in decision that it's out of scope of PHP serverside framework to force using one particular package manager for frontend that has nothing to do with serverside framework. |
It is related with interoperability in a broader sense. Since Composer is the de-facto package manager for PHP and our frameworks are widely used in frontend scenarios as well, supporting interoperability with other repositories/managers would be nice. As far as PHP-FIG is concerned, perhaps an |
It would be FIG task but not PHP-FIG one. As far as I know, there's no broader FIG group.
|
@samdark I hope you understand what you just said is non sense. |
It makes sense with missing part you've removed. |
Sorry, was referring to a FIG, a boarder FIG group. The removal was to emphasize the global, all mighty group that if it would exist it would be the go to place to get an answer if we should or not should use a tool. |
Yeah but there's no such group. PHP-FIG is all about PHP and frameworks and never crosses the line. |
@samdark I am talking about PHP-FIG and how there should be a standard on how external dependencies (those not into the target of PHP-FIG) like css/js frameworks/components, font packages, images whatever are handled as assets. But this is derailing the point of this PR here. Also @dmtrs is bringing up the point that indeed such broad FIG group does not exist, nor will in the near future, nor it is a supreme entity that we can call out for. You are in favor of forking packages and get them served from Packagist, fine. Let's at least not keep those assets within the framework itself or the extensions themselves. Should we fork every non-php dependency to be handled by Composer? I would not say so. I think we can come up with an elegant solution. Perhaps you are not satisfied with the route this PR is going (thus closing it), but I would really call you as well as other core developers and contributors to give some more thought and input. |
jQueryUI will be moved out of core/extensions. I'm not really in favor of our own packages for jQuery and jQueryUI but it's less of the evils. Forcing developers to use one particular frontend scripts manager isn't the right thing for PHP framework to do.
If you prefer bower, use bower. Yii uses only 2 such composer packages: jQuery and jQueryUI.
The correct way to solve it is to push the topic and a solution very hard to composer project. If it will be in, all the technical and non-technical problems will be solved and, I guess, Composer will allow you to use any of frontend package managers same as it allows to use PEAR/zip archives/git/hg/svn etc. |
I have another idea on how to implement this. Will link back on this issue. |
OK. |
Another approach. Comments and help welcome. |
@cebe Vote strictly against it. No need reinvent the wheel. Need bower packages — use original bower which is near to be standart for frontend package management. Why need another "very strange" and infamous solution when you can just take bower and use it? Try it. It very simple to do and you'll save your time instead of creating another no one needs library. P.S. I apologize for the tone of the message. But you not first guy who try to pervert composer goals. All such ideas fail in past. And thanks to god it fail. Because this is wrong from ideological point of view. Composer born to be php package manager. Its not package manager for everything. Need frontend package managing use frontend package managers. Its simple. Involving composer into this is just BIG mistake. |
@cebe this is a fine approach I would welcome a solution for a unified point collect all dependencies for a project. The approach @cebe is taking is the approach I was taking when mentioning that I' d close down the hack-ish PRs for something more elegant. |
Oh, one more thing @creocoder , nobody is claiming |
@pmoust there are some issue open in the new repo, could need some help in implementing things :) |
In reality there is just NO other options instead of using original bower or other frontend package manager if you goal is follow web dev bestpractice ofcourse, if not you can to use any composer exploits/plugins/workarounds/super ideas. What about alternate solution for "contrived" problem. Just copy |
Care to explain how this is bad practice exactly? Is there something that is not covered by this approach regarding at least Bower packages? Or is it a philosophical stance (which I do accept as a valid point of discussion)?. I am not being hostile, I genuinely want to know. |
And perhaps we should move to the other PR and let this #2965 RIP |
Yep. I propose discussing it at https://github.com/cebe/composer-bower |
more precisely: cebe/composer-bower#5 |
Relates to #2946
After issuing composer commands, Bower is now called to fetch jquery by invoking
bowerphp