Closed (fixed)
Project:
Superfish Dropdown Menu
Version:
8.x-1.x-dev
Component:
Code
Priority:
Critical
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
23 Dec 2016 at 16:26 UTC
Updated:
16 Jun 2017 at 00:25 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
duaelfrComment #3
duaelfrRising to Major as it is currently impossible to install superfish with composer.
Comment #4
duaelfrComment #5
geek-merlinYes, subprojects can not define repositories in composer.
We should instead get the superfish-for-drupal library into packagist or drupal packagist.
This is super easy and i'd happily help the maintainer @mehrpadin if there are questions, just PM me.
Comment #6
geek-merlinNote: we might need a note in the readme that a something like this is needed in the root composer.json:
(where web might be docroot in some projects)
Most projects have this, but not all.
Comment #7
duaelfrI had a conversation with Mixologic that maintains the drupal packagist facade.
He is working on a workaround to make these things work. (see #2843461: Consider creating package data for repository references in modules)
In the meantime we really need a fix on this composer.json file. Publishing the library on packagist wouldn't be enough right now (have a look at the content of the composer.json file and you should understand why).
Comment #8
geek-merlin> Publishing the library on packagist wouldn't be enough right now (have a look at the content of the composer.json file and you should understand why).
TBH, no. Can you elaborate?
Comment #9
duaelfrThe superfish module is trying to find its library in
/libraries/superfishbut it defines the library as "drupal/superfish-library" what would create a/libraries/superfish-librarydirectory. That's why it tries to redefine the path viaextra.installer-pathswhat, if it works here, could break all the libraries included via composer by downloading them in/libraries/superfishinstead of their own directory.Comment #10
geek-merlinHmm i thought that is the easy part of it.
* Decide on a good library path name, be it superfish, superfish-library or superfish-for-drupal (i'd suggest the latter, identical to the repo name and different from the original superfish lib - but hey, that's up to the maintainer to decide)
* Declare that name in the library's composer.json file as name
* Tell the module to find its library there (and optionally fallback to the original location for legacy sites)
Imho it's all about adapting to the composer ecosystem in the way it works instead of fighting against that principles (as long as we don't have that library packagist which may or may not happen).
Comment #11
duaelfrI agree, but we need a working version right now, even if it takes more time to decide how to do it properly (via libraries.drupal.org or Drupal facade). Right now, it's almost impossible to use this module from a composer-based project and these projects are becoming the new standard (even Drush plans to drop makefiles for composer). The #2 patch is a short term solution to allow site builders to use the module. As one of them, I'd like to get it commited asap ;)
Comment #13
mehrpadin commentedHey there,
I've just applied the patch, will do the packagist too soon as possible.
https://packagist.org/packages/mehrpadin/superfish
Thank you both!
Comment #14
duaelfrThanks @mehrpadin!
Could we tag a new RC, maybe?
Comment #15
adamps commentedOK, I'm new to composer, so sorry I say something stupid. My understanding is that composer is a tool for automatic installation of dependencies. The users expects to run "composer require drupal/superfish", and that's it. Compose should automatically fetch dependencies on initial install, and automatically update them as needed.
The superfish README now has instructions "Add the proper repository to your composer.json file". So there is a manual step, it's not automatic. In the future there might be another manual step to alter the text that was added - e.g. change to version numbers.
I think it is possible to remove the need for manual steps. Here is my suggestion:
Comment #16
adamps commentedComment #17
mehrpadin commentedHi Adam,
You're right, it's just temporary I'll remove it soon, well today hopefully! tag created anyway.
PS: We are very close to 1.0 stable I believe so please do as much testing etc as you can, thanks.
Comment #18
adamps commentedGreat, thanks. My D8 sites are still early in development, but I can certainly test the composer part when it's ready.
In case it helps you to have something to copy, I think I have just got my module RRSSB working seamlessly in composer - you must take the dev version.
Comment #19
abe commentedfollowing this issue.
I submitted related question earlier in https://www.drupal.org/node/2857720#comment-11968844
I am new to composer. I have changed the composer.json file (generated from drupal-project) to contain:
----------
"web/libraries/{$name}": ["type:drupal-library",
"mehrpadin/superfish"],
----------
then I exec'ed
$ composer require mehrpadin/superfish
--> I got no errors, but
The superfish js/css libraries (version ^2.0 ) were installed in vendor/mehrpadin/superfish instead of web/libraries/superfish.
Thanks.
Comment #20
geek-merlin@mehpadin: Can you do the 3 klicks? This would really ease things.
If you can use assistance, i'll be glad to help in chat or so.
Comment #21
mehrpadin commentedHey everyone,
The library was added back then, but I think I'm gonna have to give up on this whole Composer thing for now and release the 1.0 stable anyway; just for the time being until Drupal finds a way to handle external libraries like the one we have here without any hassle.
The problem used to be this
"composer/installers": "^1.0.24"; well, few months ago when I tried the composer.json I thought ok it's working but I must have been mistaken, I probably had the library installed already but thought the Composer installed it etc, when I tested it for real it did not work, I had some errors about the composer/installers version in the composer.json of the Drupal itself etc, I cannot recall much but I think it was something like it couldn't be bumped to the latest version, just in case you don't know you'd need v1.0.24 of the composer/installers in order to use directories other than /vendor, according to Drupal documentation for Composer:Back in the day the default version was 1.0.20 or something like that, so it wasn't working and I couldn't find a way.
When I had the v8.3.1 installed few days ago I realized they have updated the composer/installers to 1.0.24 that was good news until I tested again and although I didn't get that error message any more - well why would I - the "installer-paths" was always ignored and I was unable to put the library anywhere other than /vendor :\
Searching a little bit I came across this page from the Composer website,
https://getcomposer.org/doc/faqs/how-do-i-install-a-package-to-a-custom-...
This is misleading, having
["vendor/package"]there in that example made me think okey maybe it should be"drupal-library"instead of"type:drupal-library", so I tried that and it didn't work either.Later I came across this new note on that same documentation page:
Guess what? that didn't work either, not even for Dropzone. I've also tried the
drupal/webprofilerfrom the Devel module which had thecomposer-installers-extenderas a requirement, and everything went to /vendor.Searching even more I have found these:
https://www.drupal.org/node/2866988
https://www.drupal.org/node/2866109
https://www.drupal.org/node/2813897#comment-11707897
and also this:
https://www.drupal.org/node/667058
I'm not quite sure when this will be taken care of, but until then I'll give up on this, it appears there are other people giving up too:
https://www.drupal.org/node/2605130#comment-11868488
Comment #22
geek-merlinSo we just need the library-installer-path:
Even though this does not come from core undtil #2813897: Add composer installer-paths by default is decided, we can still add a README instruction to add it.
Many people have it anyway in their composer.json.
So great that we have the composer package, we only need to update README and composer.json
Comment #23
duaelfrThe latest dev version breaks all the things again.
The way the drupal packagist is done prevents all previous releases of superfish to be installed because of this wrong syntax. (It seems to only use the composer.json file of the latest dev version)
You are right, you should wait until there is a way to handle these dependencies properly.
Comment #24
geek-merlin@mehrpadin: no need to do all the fight like #21 alone, just post here, that's how drupal works.
@DuelFr: Thanks for pointing that out and rolling a patch.
In fact putting the library on packagist and adding tha dependency is all there is to do.
Otoh we *must not* interfere with site setup by making additional requirements. This can even break a site.
That drupal core ist still discussing library handlin e.g. in #2813897: Add composer installer-paths by default is not a problem, as many (if not most) people use drupal-project which has the library installer path built in.
Patch flying in that
* builds on the previous patch
* removes all superfluous and possibly harmful composer.json content
* updates README
Comment #25
geek-merlinAh, now i understand #23: An invalid version constraint prevents composer from installing the dev at all.
Setting critical thus.
Comment #27
mehrpadin commentedHey there,
Thank you both, just applied the patch but I'm not much happy about how so such simple things are handled, D8 had to have all these covered, anyway! hopefully we can release the first stable version now?
Comment #28
geek-merlinFinally i came to test this. Not finally fixed yet.
@mehrpadin: We just need a tiny thing to be changed to work:
* Add "type: drupal-library" to the library json.
Then we should be able to close this!
Comment #29
Lowell commentedI'm pretty sure if you have
"composer/installers": "^1.0.21"as a requirement and the "drupal-library" configuration in the composer.json, then composer will know to put the library in the /libraries folder. Might be worth a test run.Comment #30
geek-merlinNope. I tested it. Without the #28 change, the library is recognized as "library", not "drupal-library", and goes into /vendor/...
Comment #31
Lowell commentedYes, exactly. The library's composer.json needs the type: drupal-library configured so that the composer/installers knows what to do with it
Comment #32
Lowell commentedMy thought is that with composer/installers as a requirement, there are no extra steps needed in the instructions for a composer based installation. It looks like it works with both the drupal-drupal and the drupal-composer based installs
Comment #33
Lowell commentedWell, actually I think composer/installers is already in the root composer.json for both methods, so only the type: drupal-library is really needed, just like you stated in #28
Comment #34
mehrpadin commentedHey,
Thanks, just added that?
Comment #35
Lowell commentedAwesome, I just tested the latest dev branch and it does get the library as needed. Nice work.
Comment #36
geek-merlinOK i see that's on 2.x.
Now we need to
* make a 2.1 release of the library
* require the in the module's composer.json
* test
* open champagne ;-)
Comment #37
mehrpadin commentedGreat, thank you folks!
Axel, may I ask why we would need a v2.1?
Comment #38
geek-merlin> Axel, may I ask why we would need a v2.1?
* the fix is in the library's 2.x dev version
* it is *not* in the 2.0 version that is required by the module
Comment #39
mehrpadin commentedGetting senile :\
v2.1 created & I've just also released the 1.0 stable for the module.
Comment #40
geek-merlinTested a composer update today and it looks like everything works as expected.
Champagne!