Provide core CLI commands for the most common features of drush

Created on 21 October 2019, almost 5 years ago
Updated 16 July 2024, 2 months ago

Problem/Motivation

Realistically, most people install Drush straight after the install Drupal. Those who don't aren't aware that Drush exists.
As a Drupal developer I chart my Drupal career as 'before Drush' and 'after Drush'. Luckily I found Drush in the D5 days, so the before drush period was short.

Since Drupal 8 Drush compatibility with core has been tricky as both lean heavily on Symfony components.

In Drupal 8.4 core moved to Symfony 3 components which meant Drush had to also update to Symfony 3 in order to be installed via composer. This caused quite a lot of difficulty for people updating ( #2874827: Drush 8.x doesn't install Drupal 8.4.x and Drush master doesn't install Drupal 8.3.x β†’ ). There was also a disconnect between when core 8.4 was released and when people were productive as there was a need to wait for a new version of Drush.

With Drupal 9, core has updated to Symfony 4 components, which means Drush will now have to release a version 11 with a bump of its Symfony components too.

Proposed resolution

We already have Symfony console component in Drupal core (/core/scripts/drupal) and it has some commands.

Having these as part of core removes the burden from Drush having to rely on core updating its Symfony components but also provides maximum productivity for CLI users out of the box. Non technical users will also experience easier upgrades as they won't need to debug why composer won't update when there are lock file conflicts with Drush.

Remaining tasks

  • Buy in from core product managers and drush maintainers
  • Approval
  • Planning
  • Create an initiative
  • Build an initiative team
  • Build the tool

Profit!

User interface changes

None

API changes

New API for providing console commands in core.

Data model changes

Release notes snippet

✨ Feature request
Status

Active

Version

11.0 πŸ”₯

Component
BaseΒ  β†’

Last updated about 5 hours ago

Created by

πŸ‡¦πŸ‡ΊAustralia larowlan πŸ‡¦πŸ‡ΊπŸ.au GMT+10

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • πŸ‡ΊπŸ‡ΈUnited States Mile23 Seattle, WA

    #2242947: Integrate Symfony Console component to natively support command line operations β†’ is still out there and postponed, but I def want to point out another which seems to have more energy on the follow-through at this point:

    ✨ CLI entry point in Drupal Core (Dex) Needs review

  • πŸ‡¬πŸ‡§United Kingdom catch

    I think this issue is better off in the core queue, needs architecture more than product discussion.

  • πŸ‡¬πŸ‡§United Kingdom AaronMcHale Edinburgh, Scotland

    Not sure what the best component for this is, but going with base system, since I'm guessing setting it to ajax was probably an unintended change of moving to from ideas to core ;)

  • πŸ‡ΊπŸ‡ΈUnited States neclimdul Houston, TX

    I keep forgetting Drupal even provides commands. They aren't quite at the point the can replace any drush workflows for me though I guess.

    Maybe we should start moving this in front of people more. The Drupal console isn't active these days so since it won't conflict could we start pushing core/scripts/drupal into vendor/bin/

    Then maybe we could start looking at using a discovery mechanism of some sort for auto discovering commands instead of hard coding them.

    Then we could encourage people could start tinkering with this, testing real world use cases, without hacking on core as directly?

  • I just looked into this yesterday. I had forgotten about the built-in commands, too. However, I use DDEV Drupal Contrib, and when I set up a contrib module dev environment, Drush isn't installed, unless the contrib module has it in its composer.json, which almost none do.

    So I was trying to find a way to install Drupal from CLI, without Drush. It's not easy, and the built-in commands don't support arguments for all the options available in the UI, and you can't use MySQL instead of SQLite as far as I know.

  • πŸ‡ΊπŸ‡ΈUnited States mradcliffe USA

    @neclimdul, Mile23 linked to the most recent development on discovery.

    @solideogloria, I was trying to work on that, but i haven't been able to write tests successfully for it in #2894476: Provide commands which are helpful for core development β†’ .

  • πŸ‡¬πŸ‡§United Kingdom joachim

    @solideogloria you can install Drush into the project yourself.

  • One of DDEV Drupal Contrib's features is that it does all of its work without modifying the module's composer.json. If I want to install Drush into the project myself, I have to modify composer.json.

  • πŸ‡ΊπŸ‡ΈUnited States rfay Palisade, CO, USA

    I demonstrate how to do this without changing composer.json in https://github.com/justafish/ddev-drupal-core-dev/pull/33 - that could be done anywhere. @joachim has more opinions about how to manage this problem. But it's not a very big lift to just install drush and then let git and composer.json forget that you did it.

  • I like that command. That would be a cool addition!

  • πŸ‡¬πŸ‡§United Kingdom joachim

    @rfay, indeed, @joachim will point out that https://github.com/joachim-n/drupal-core-development-project does it without making changes to core's composer.json. I've filed PRs on justafish/ddev-drupal-core-dev to make it work with that Composer project template.

  • πŸ‡ΊπŸ‡ΈUnited States greg.1.anderson

    I like the discovery option proposed in #47. In the issue linked there, there is also a proposal to expose core/scripts/drupal as vendor/bin/drupal. No one from Drupal Console has weighed in on any future development plans related to that issue yet.

    I will also point out that Starshot ships with Drush pre-installed, which will be helpful for folks who start with that as a base, rather than Drupal core. For core development, though, I like #57.

Production build 0.71.5 2024