Make the DDEV launcher script more relaxed and fault-tolerant
>>> [!note] Migrated issue <!-- Drupal.org comment --> <!-- Migrated from issue #3494020. --> Reported by: [itamair](https://www.drupal.org/user/1179076) Related to !312 >>> <p>The <code>launch-drupal-cms.sh</code> script added by <span class="drupalorg-gitlab-issue-link drupalorg-gitlab-link-wrapper"><a href="https://git.drupalcode.org/project/drupal_cms/-/work_items/3493354" class="drupalorg-gitlab-link">https://git.drupalcode.org/project/drupal_cms/-/work_items/3493354</a></span> is showing early potential to create a lot more problems than it solves. It is a complicated script that reacts poorly to the presence of unexpected files. Its purpose is also dubious -- it works <em>against</em> DDEV, not with it, in exchange for the convenience of not typing a few fairly simple commands. Convenience is a good thing to aim for, but if those conveniences are buggy or fragile, we are creating more work for ourselves (at a time when we need to focus on delivering a stable release), and worse yet, frustration for users. Especially first-time users.</p> <p>For that reason, let's refactor it and significantly relax its approach. Rather than using <code>ddev composer create</code>, which absolutely <em>requires</em> that you run it in a completely empty directory (a restriction that makes the launcher very complex and prone to problems), let's simply have it do a simple <code>ddev config ... &amp;&amp; ddev composer install &amp;&amp; ddev launch</code> sequence. Those few commands will give you the same end result, without needing to do anything special, and they maintain the top goal of <span class="drupalorg-gitlab-issue-link drupalorg-gitlab-link-wrapper"><a href="https://git.drupalcode.org/project/drupal_cms/-/work_items/3493354" class="drupalorg-gitlab-link">https://git.drupalcode.org/project/drupal_cms/-/work_items/3493354</a></span>, which is to not ship a <code>.ddev</code> directory in the project template.</p> <h3>Proposed resolution</h3> <p>The launcher script should do only the work it needs to do:</p> <pre>ddev config ... # if there's no .ddev directory already<br>ddev start<br>ddev composer install # if there's no composer.lock yet<br>ddev launch</pre><p>This also makes it re-entrant. For example, if the <code>ddev config</code> step succeeds but the <code>ddev composer install</code> step fails, you can just re-run the script and it won't re-do anything it doesn't need to.</p> <h2>Original bug report</h2> <p>I am on Mac OS X, with latest DDEV 1.24.0<br> and when running the following: ./launch-drupal-cms.sh<br> the process stops with the following error message:</p> <blockquote><p>Failed to create '[my_path_to_drupal_cms_folder]/.DS_Store' is not allowed to be present. composer create needs to be run on a clean/empty project with only the following paths: [web web/sites web/sites/default web/sites/default/.gitignore web/sites/default/files web/sites/default/files/sync web/sites/default/settings.ddev.php web/sites/default/settings.php] - please clean up the project before using 'ddev composer create' </p></blockquote> <p>It looks the installer finds a .DS_Store file (typical of Mac OS X) that I even cannot see and find in the drupal-cms folder, also as invisible file.</p> <p>What is wrong in my setup, or what am I doing wrong?</p> <p>attaching a screenshot of my PHP Storm window, with the Terminal flow.</p>
issue