Accelerate site template authors by providing a Drush command that can export a fully built site as a recipe
>>> [!note] Migrated issue
<!-- Drupal.org comment -->
<!-- Migrated from issue #3551059. -->
Reported by: [phenaproxima](https://www.drupal.org/user/205645)
Related to !649
>>>
<h3 id="summary-problem-motivation">Problem/Motivation</h3>
<p>I was working on my session slides for DrupalCon Vienna, which is about how to build a site template. And I realized a few things:</p>
<ul>
<li>At this juncture, the process of building a site template is really a two-step thing: build a site, then export it as a recipe.</li>
<li>Exporting as a recipe is fiddly and kind of painful.</li>
<li>It is not necessary to have the recipe be cleanly architected and divvied up into smaller, useful recipes the way Drupal CMS is. Recipes, having no update path, can be refactored at any time.</li>
</ul>
<p>To me, that means we need to have tooling in Drupal CMS that can help and accelerate site builders -- the people who will make site templates.</p>
<h3 id="summary-proposed-resolution">Proposed resolution</h3>
<p>We should add a Drush command, <code>site:export</code>, that exports the current site's configuration and content into a recipe. This means:</p>
<ul>
<li>The <code>_core</code> and <code>uuid</code> keys are scrubbed from the config.</li>
<li>The <code>core.extension</code> config is removed, and transferred into the recipe's <code>install</code> list and composer.json requirements.</li>
<li>The System and User module's simple configuration is always guaranteed to exist before the recipe is applied, so these config objects have to be changed with the <code>simpleConfigUpdate</code> action.</li>
</ul>
<p>This will be good because it means we can definitively tell people that this is, for now, the quickest way to build a site template:</p>
<ol>
<li>Install Drupal CMS.</li>
<li>Configure the site as you please.</li>
<li>Run <code>drush site:export</code>.</li>
</ol>
<p>That's the whole thing, apart from the look-and-feel part, which is covered by Canvas and/or a bespoke theme.</p>
<p>I tested the current MR out with Umami. Although there are rough edges -- specifically, known problems and limitations pertaining to multilingual support in recipes -- running <code>drush si path/to/exported/umami</code> actually reinstalls Umami. From the recipe. And it looks correct. Kind of incredible, actually.</p>
> Related issue: [Issue #3002532](https://www.drupal.org/node/3002532)
issue