Converting to a composer-based workflow in D8

Submitted by John on Sat, 06/16/2018 - 00:44

I was recently inspired by Jeff Geerling's blog post on the subject of taking a Drupal 8 project, not using composer to managed dependencies, and moving it to doing so. His blog post is a good read.

I wanted to do the same thing, but for more complex code-base. Ultimately, this sounds like a very tedious process. But at least there does seem to be some attempts to make this a more simple one., and But I decided to try to roll my own instead. 

I give you Composer Converter! Ok, this is just an extremely rough attempt to parse the output of $ drush pml and turn that into a script of a bunch of composer require commands.  

One gotchya is it ending up setting dependencies of sub-modules in your root composer.json (rh_node). This can be especially problematic when later trying to update modules that have some false dependencies set in them.