drupal-finder icon indicating copy to clipboard operation
drupal-finder copied to clipboard

Add new method ::getVendorBin()

Open gheydon opened this issue 2 years ago • 2 comments

As part of this change I investigated a few projects to see how they are doing this such as upgrade status and upgrade rector and they both have something similar to this but both do it in different ways.

I think this is the definitive method of determining the vendor bin and gives a centralised method of accessing this information so many projects doing have to add it themselves.

One minor issue i found this this is that in my clients config the config.bin-dir is set to bin/ which means that when the vendor dir is returned it has the trailing /. so when you do something like

$bin = $drupalFinder->getVendorDir() . '/rector';

you will get /composer_root/bin//rector. this is ok, but a little messy. But I am also assuming it you set config.vendor-dir to something like 'vendor-here/' then the same issue will happen.

gheydon avatar May 30 '23 00:05 gheydon

I will note that the docs for the vendor-bin config don't include a trailing slash:

Defaults to vendor/bin.

https://getcomposer.org/doc/06-config.md#bin-dir

davereid avatar Jun 24 '23 03:06 davereid

Until this project adds it, use the Composer API for this - https://getcomposer.org/doc/07-runtime.md#binary-bin-dir-path-in-binaries

weitzman avatar Nov 13 '23 15:11 weitzman