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

Add exception for missing composer.json file/document need for composer.json file

Open jamiehollern opened this issue 7 years ago • 5 comments

A project I worked on removed the composer.json as a security precaution, which in turn broke Drush. It turns out that this is because it uses drupal-finder to ascertain the Drupal root, which uses composer.json to figure that out. It would be handy to throw a specific exception for this instance, and to document it somewhere.

jamiehollern avatar Aug 15 '18 17:08 jamiehollern

also throw for unparseable json.

weitzman avatar Mar 13 '19 12:03 weitzman

+1 I happened to have a comma where there shouldn't be one. It took me several hours before I noticed after having reinstalled drush, drush-laucher and drupal-vm.

hepabolu avatar May 14 '19 21:05 hepabolu

+1 Would also be nice to add an option to disable the check for the composer.json file. In case it is not present, because it is not required for running Drupal. Why is this check needed? Wouldn't it be a possibility to just check the VERSION constant inside core/lib/Drupal.php instead?

orlandothoeny avatar Jul 26 '19 13:07 orlandothoeny

+1 for this. I deployed a build artifact and obviously saw no need to include the composer.json. This makes drush not work since DrupalFinder requires a composer.json.

johnzzon avatar Sep 20 '19 07:09 johnzzon

Yup this definitely makes sense and adds important debug information.

JPustkuchen avatar Nov 16 '20 16:11 JPustkuchen