Answers.Body: <p>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:</p>
  <p>If you want you can copy composer.json , composer.lock to a new directory (or local) and use issue <code>composer install</code>to 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.</p>
  <pre><code>composer remove roundearth/civicrm-composer-plugin --no-update
  composer config extra.enable-patching true
  </code></pre>
  <p>civicrm/civicrm-{core,packages,drupal-8}:'^[civicrm latest version without the point version]'</p>
  <p>Apart from the removal of the roundearth/civicrm-composer-plugin you want to follow the install steps outlined here:
  <a href="https://docs.civicrm.org/installation/en/latest/drupal8/" rel="nofollow noreferrer">https://docs.civicrm.org/installation/en/latest/drupal8/</a></p>
  <p>(Note D9 Drupal recommended you'll need to set the minimum stability from stable to dev if you haven't already).</p>
  <p>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.</p>
  <p>Assuming this is successful you will then want to
  drush updb
  drush cr</p>
  <p>I'd also recommend clearing out
  web/libraries/civicrm/
  and then repopulating with composer civicrm:publish</p>
  <p>This is something you might need to repeat on live.</p>
  <p>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.</p>
  <p>Options to make things easier.</p>
  <ul>
  <li>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.</li>
  <li>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.</li>
  <li>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.</li>
  <li>add --no-update to the second require then you can use composer update --dry-run along with all the packages you are adding/removing.</li>
  </ul>
  <p>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.</p>
  <pre><code>$civicrm_paths['civicrm.root']['url'] = '/libraries/civicrm/';
  $civicrm_paths['civicrm.packages']['url'] = '/libraries/civicrm/packages/';
  </code></pre>
  <p><strong>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!</strong></p>
  <p>I had done this once and I described it at <a href="https://lab.civicrm.org/dev/drupal/-/issues/115#note_34161" rel="nofollow noreferrer">https://lab.civicrm.org/dev/drupal/-/issues/115#note_34161</a></p>
  <ol>
  <li>Backup civicrm.settings.php and drupal settings.php.</li>
  <li>Delete everything in the root folder, including drupal.</li>
  <li>cd <code>&lt;one folder up from root&gt;</code></li>
  <li><code>composer create-project drupal/recommended-project:8.x.y &lt;root folder&gt;</code></li>
  <li>cd <code>&lt;into root folder&gt;</code></li>
  <li>SET COMPOSER_MEMORY_LIMIT=-1 (or <code>export COMPOSER_MEMORY_LIMIT=-1</code> for unix)</li>
  <li>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</li>
  <li>restore civicrm.settings.php and drupal settings.php</li>
  <li>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. <strong>remove these lines</strong></li>
  </ol>
  <pre><code> $civicrm_paths['civicrm.root']['url'] = '/libraries/civicrm/';
   $civicrm_paths['civicrm.packages']['url'] = '/libraries/civicrm/packages/';
  </code></pre>
  <ol start="10">
  <li>log in and clear caches</li>
  </ol>
  <p>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.</p>
  <p>Also the above was for a dev install, using dev-master. Replace dev-master with a specific <code>5.x.y</code> or <code>^5.x</code> as desired.</p>
  <p>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.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-06-18T03:29:22.873Z
Answers.Text: I have pursed a slightly different path - This should be done on a dev/staging site. remove vendor ,composer.json and web/libraries/civicrm (this will be updated with a new structure but the existing structure will not be removed.) After doing so use https://lab.civicrm.org/dev/drupal/snippets/43 to create a new composer.json somewhere. Merge drupal modules and themes (and possible patches etc) in from your existing composer.json - and replace your composer.json with the result of this merge. Either do manually or composer require --no-update etc.   Then composer update --with-all-dependencies
Answers.UserDisplayName: Luke Stewart
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-06-18T03:30:13.360Z
Answers.Text: Before doing the above recommend running any updates you can separately.
Answers.UserDisplayName: Luke Stewart
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-06-19T04:08:56.187Z
Answers.Text: I've made some edits to the above after running this process on another site - also you probably don't want to wipe everything in webroot! as this will include a lot of stuff you don't want to delete.
Answers.UserDisplayName: Luke Stewart
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-06-19T04:14:09.813Z
Answers.Text: Cool. I had a similar note in the caveat but you're right that something like that should be up front, or at least in Comic Sans. Why does stackexchange not have Comic Sans???
Answers.UserDisplayName: Demerit
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-06-18T02:17:28.860Z
Answers.LastActivityDate: 2020-12-06T21:14:06.290Z
Answers.LastEditDate: 2020-12-06T21:14:06.290Z
Answers.UserDisplayName: Demerit
Body: <p>From an existing site set up using the roundearth composer plugin method as detailed -&gt; <a href="https://www.mydropwizard.com/blog/better-way-install-civicrm-drupal-8" rel="noreferrer">https://www.mydropwizard.com/blog/better-way-install-civicrm-drupal-8</a></p>
  <p>composer create-project roundearth/drupal-civicrm-project:8.x-dev some-dir --no-interaction</p>
  <p>How do I update this to use the newer <a href="https://lab.civicrm.org/dev/drupal/snippets/43composer" rel="noreferrer">https://lab.civicrm.org/dev/drupal/snippets/43composer</a> require civicrm/civicrm-asset-plugin:'~1.0.0' pear/pear_exception:'1.0.1 as 1.0.0' civicrm/civicrm-{core,packages,drupal-8}:'^5.25' --prefer-source</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2020-06-18T01:58:10.673Z
Comments.Text: https://lab.civicrm.org/dev/drupal/-/issues/115#note_34161
Comments.UserDisplayName: Demerit
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2020-06-18T02:09:55.507Z
Comments.Text: Aha - I knew this was somewhere! If you start on an answer below I can accept!
Comments.UserDisplayName: Luke Stewart
Tags: <drupal><drupal-8><composer>
Title: Drupal 8: How do I shift a project/site from using the roundearth installation method to the CiviCRM official composer asset plugin
ThreadText: # Drupal 8: How do I shift a project/site from using the roundearth installation method to the CiviCRM official composer asset plugin
  
  (Asked by: username_0 on 2020-06-18)
  
  From an existing site set up using the roundearth composer plugin method as detailed -> <https://www.mydropwizard.com/blog/better-way-install-civicrm-drupal-8>
  
  composer create-project roundearth/drupal-civicrm-project:8.x-dev some-dir --no-interaction
  
  How do I update this to use the newer <https://lab.civicrm.org/dev/drupal/snippets/43composer> require civicrm/civicrm-asset-plugin:'~1.0.0' pear/pear\_exception:'1.0.1 as 1.0.0' civicrm/civicrm-{core,packages,drupal-8}:'^5.25' --prefer-source
  
  **Tags:** drupal, drupal-8, composer
  
  > **Comments:**
  > **username_1**: https://lab.civicrm.org/dev/drupal/-/issues/115#note_34161  
  > **username_0**: Aha - I knew this was somewhere! If you start on an answer below I can accept!  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2020-06-18. Score: 5
  
  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 install`to 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 "pear/pear\_exception:'1.0.1 as 1.0.0'" 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>
  
  1. Backup civicrm.settings.php and drupal settings.php.
  2. Delete everything in the root folder, including drupal.
  3. cd `<one folder up from root>`
  4. `composer create-project drupal/recommended-project:8.x.y <root folder>`
  5. cd `<into root folder>`
  6. SET COMPOSER\_MEMORY\_LIMIT=-1 (or `export COMPOSER_MEMORY_LIMIT=-1` for unix)
  7. 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
  8. restore civicrm.settings.php and drupal settings.php
  9. 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/';
  
  ```
  
  10. 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 "2 months ago" doesn't quite work "now". I have not tried the above in the last 2 months.
  
  > **Comments:**
  > **username_0**: I have pursed a slightly different path - This should be done on a dev/staging site. remove vendor ,composer.json and web/libraries/civicrm (this will be updated with a new structure but the existing structure will not be removed.) After doing so use https://lab.civicrm.org/dev/drupal/snippets/43 to create a new composer.json somewhere. Merge drupal modules and themes (and possible patches etc) in from your existing composer.json - and replace your composer.json with the result of this merge. Either do manually or composer require --no-update etc.   Then composer update --with-all-dependencies  
  > **username_0**: Before doing the above recommend running any updates you can separately.  
  > **username_0**: I've made some edits to the above after running this process on another site - also you probably don't want to wipe everything in webroot! as this will include a lot of stuff you don't want to delete.  
  > **username_1**: Cool. I had a similar note in the caveat but you're right that something like that should be up front, or at least in Comic Sans. Why does stackexchange not have Comic Sans???  
  
  ---
  
  