Problem/Motivation

The new setup-drupal command has a wizard to populate the .env file with values generated from the directory path, and prompt users for values, making it a quick/easy way to get started with Drupal Flake. The original implementation was built to install from scratch, from a variety of composer starting points.

This functionality is also useful for quickly getting started with Drupal Flake in an existing project -- why not make it work there, too?

Steps to reproduce

Before (right now): setup-drupal has no safety checks - it runs composer create-project targeting a subdirectory, and then copies the result to the project root, overriding anything existing.

Proposed resolution

Add two modes for setup drupal: --existing, and --new. This defaults to --new in an otherwise empty directory, and --existing if there is existing code.

--new will download a Drupal distro and install it, after creating the .env file from the prompts.

--existing will generate a .env file if one doesn't already exist, and exit.

Neither will overwrite an existing .env file unless used with --force. It can add flake-specific values to an existing .env file.

Remaining tasks

Implement.

User interface changes

API changes

Data model changes

Comments

freelock created an issue. See original summary.

  • freelock committed c4b7202e on 1.0.x
    feat: #3619760 Enhance setup-drupal script to safely set up in existing...
freelock’s picture

Status: Active » Needs review

Initial implementation pushed to 1.0.x for testing.