Moving to drupal/recommended-project

Submitted by Unifex on

Back in the early days of Drupal 8 there were a number of competing composer projects aimed at standing up a Drupal site from a simple composer command on the CLI. The one I settled on was one of the more active at the time. However, it was not the one that was ultimately adopted by the community.

Backup all the things

If, like me, you were having a difficulty finding the time to figure out how to switch from one of the other projects to drupal/recommended-project then hopefully this may help out. For reference, I was moving from drupal-composer/drupal-project to drupal/recommended-project.

The process was actually fairly straight forward in the end. Start with the usual caveats: Backup all the things.

Clear out composer:

$ rm composer.* && rm -rf vendor

Create a new project in a throw-away directory:

$ composer create-project drupal/recommended-project .

Copy the composer.json file to your project. Edit this file and, referencing your previous backup of the composer.json, copy and paste the module you have in the require section to the new file.

Call composer update. This should rebuild the vendor directory. Do the usual drush cr && drush updb.

You should be good to go. Check the Update Status in the admin area, check some of your content, crack a beer.

This process worked for me. As with anything software related, your k's may vary.

Why Drupal 8?

This version of the site has been around since early Drupal 8 and has been treated as a bit of a testbed for things. There are still a few modules that are not D9 ready yet. I use Gutenberg as my editor. It's a nice experience. It's not D9 compatible yet.

Options from here: Helping out with the modules I'm needing and/or creating a new site with a much tidier structure and migrate the older content.

I'm tending towards a combination of both.