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

Drastically simplify using Composer Runtime API

Open weitzman opened this issue 1 year ago • 10 comments

I think this is all thats needed now that Composer provides a Runtime API to get the paths we want.

  • No longer dependant on authors customizing their composer.json
  • Comes with tests.
  • This should be a new major version.

weitzman avatar Nov 11 '23 21:11 weitzman

This PR was motivated by DrupalFinder not working at https://github.com/ddev/ddev-drupal-contrib/pull/14 (composer.json not customized, on purpose)

weitzman avatar Nov 12 '23 04:11 weitzman

I was converging on this, as well, for phpstan-drupal. I think it's safe to say everyone is on the correct version of Composer, which added this. It's been two or three years, maybe more?

It'd be great to have this merged and kick off the 2.x of the package.

mglaman avatar Nov 13 '23 14:11 mglaman

I have extended the test coverage and added support for custom vendor-dir. This is rarely used, but we should nevertheless have it supported.

Added a test-case for "default" Drupal with customized path in extra.installer-paths.

webflo avatar Nov 15 '23 23:11 webflo

Are there more obscure test cases?

webflo avatar Nov 15 '23 23:11 webflo

I think this is OK. Custom vendor directory should automatically be handled in the compiled runtime data, as Composer installed its information there.

mglaman avatar Nov 15 '23 23:11 mglaman

The README file needs work. The purpose of this library has changed with this PR. It no longer uses the "current path" or filesystem.

I was wondering if we should keep the old DrupalFinder class around, and rename it to DrupalFinderFilesystemDiscovery or something similar. The composer runtime approach works for tools within the shared autoloader. DrupalFinderFilesystemDiscovery should be used to locale a Drupal installation in a generic way.

webflo avatar Dec 06 '23 23:12 webflo

I personally would recommend the 1.x branch for non composer tools.

weitzman avatar Dec 07 '23 01:12 weitzman

Updated README.

weitzman avatar Dec 23 '23 12:12 weitzman

  • 🚀 would love to see this get in

bimsonz avatar Feb 16 '24 18:02 bimsonz

Hit this while trying to add mglaman/phpstan-drupal to a local module that uses ddev/ddev-drupal-contrib

tyler36 avatar Mar 22 '24 01:03 tyler36

Merged https://github.com/webflo/drupal-finder/pull/65 instead

webflo avatar May 08 '24 21:05 webflo