Drupal 8: How do I shift a project/site from using the roundearth installation method to the CiviCRM official composer asset plugin
Depending on how your initial site set up was created you might need to take a more extreme option detailed below but hopefully the following will work:
If you want you can copy composer.json , composer.lock to a new directory (or local) and use issue composer installto check the below works this can be useful if you are having problems and need to remove composer.lock and vendor. But I'm assuming you are going to be doing this on dev/staging.
composer remove roundearth/civicrm-composer-plugin --no-update
composer config extra.enable-patching true

civicrm/civicrm-{core,packages,drupal-8}:'^[civicrm latest version without the point version]'
Apart from the removal of the roundearth/civicrm-composer-plugin you want to follow the install steps outlined here:
https://docs.civicrm.org/installation/en/latest/drupal8/
(Note D9 Drupal recommended you'll need to set the minimum stability from stable to dev if you haven't already).
If you are still on an older version of civicrm you might need to include pear/pear_exception:'1.0.1 as 1.0.0' in the above require. But the latest version doesn't require this anymore.
Assuming this is successful you will then want to
drush updb
drush cr
I'd also recommend clearing out
web/libraries/civicrm/
and then repopulating with composer civicrm:publish
This is something you might need to repeat on live.
Note hopefully soon &quot;pear/pear_exception:'1.0.1 as 1.0.0'&quot; will not be required. Check the install instructions and mirror them.
Options to make things easier.

If your civicrm is not latest either upgrade first (best option) or use '[civicrm latest version]' (note missing '^' and you want full version with patch level i.le. '5.26.2' not '^5.26') to lock yourself to the specific civicrm version in composer.json - you will want to update to add the '^' in once complete and remove the point version to allow upgrades - or you might want to leave it like this to prevent composer update upgrading civicrm.
If you get composer conflicts in your dev/sandbox environment remove vendor and composer.lock. This will mean that you then end up running upgrades on everything - so best to do these first, or lock anything you need not upgraded in composer.json.
If you forget to remove roundearth/civicrm-composer-plugin you'll run into problems with resources not being copied correctly across to web/libraries. If you are not seeing the menu on load or are missing seeing an error for a missing file extension-compatibility.json you might need to make sure you have removed roundearth/civicrm-composer-plugin fully.
add --no-update to the second require then you can use composer update --dry-run along with all the packages you are adding/removing.

As per below check your civicrm.settings.php file and make sure the following are either removed or match the location where the libraries are stored.
$civicrm_paths['civicrm.root']['url'] = '/libraries/civicrm/';
$civicrm_paths['civicrm.packages']['url'] = '/libraries/civicrm/packages/';

The extreme version below assumes you have no custom themes/modules or file uploads. If you have any of the above. You probably want to follow a different root!
I had done this once and I described it at https://lab.civicrm.org/dev/drupal/-/issues/115#note_34161

Backup civicrm.settings.php and drupal settings.php.
Delete everything in the root folder, including drupal.
cd &lt;one folder up from root&gt;
composer create-project drupal/recommended-project:8.x.y &lt;root folder&gt;
cd &lt;into root folder&gt;
SET COMPOSER_MEMORY_LIMIT=-1 (or export COMPOSER_MEMORY_LIMIT=-1 for unix)
composer require civicrm/civicrm-asset-plugin:~1.0.1 civicrm/civicrm-core:dev-master civicrm/civicrm-packages:dev-master civicrm/civicrm-drupal-8:dev-master
restore civicrm.settings.php and drupal settings.php
If you have the two extra lines in civicrm.settings.php that were needed after roundearth+civi5.23, then you don't need them anymore, i.e. remove these lines

 $civicrm_paths['civicrm.root']['url'] = '/libraries/civicrm/';
 $civicrm_paths['civicrm.packages']['url'] = '/libraries/civicrm/packages/';


log in and clear caches

CAVEAT: As described in that thread it really depends where you started from and additionally what else you have installed via composer on that site and so you might not want to remove the whole drupal folder. The above was a pretty plain stock site and I was also converting to drupal-recommended at the same time. If you keep some things and for example if you've installed fancy modules, you may see composer throwing up irreconcilable differences.
Also the above was for a dev install, using dev-master. Replace dev-master with a specific 5.x.y or ^5.x as desired.
Further disclaimer: Civi + d8 has been a constantly moving target. It's repeatedly come up that what worked &quot;2 months ago&quot; doesn't quite work &quot;now&quot;. I have not tried the above in the last 2 months.