Happyculture / combawa

Helper to set up Drupal projects and build them all along their life.
GNU General Public License v3.0
14 stars 2 forks source link

Drupal 10 upgrade: Pick an alternative to Drupal console to generate the files #70

Closed DuaelFr closed 10 months ago

DuaelFr commented 4 years ago

Being a Drupal Console library

Drush is now providing a way to generate some code. Investigate to see if it would be as effective as Drupal Console so we can replace it. (see https://docs.drush.org/en/9.x/generators/)

TODO:

DuaelFr commented 4 years ago

To have Drush Generators outside of a module, the package has to be declared as a drupal-drush package which could lead to the same issue as #26. BUT, drupal-drush type is declared by default in the drupal-composer/drupal-project and the drupal/recommended-project packages so it should not be an issue in most of the projects.

The Drush Generators are also using the symfony components to allow nice interactive shells and twig templates.

I think we should drop the Drupal Console dependency and rewrite the generators for drush for the 9.0.0 version.

DuaelFr commented 4 years ago

Blocked by https://github.com/drush-ops/drush/issues/4547

DuaelFr commented 2 years ago

This is not blocked anymore since Drush 10. We will be able to rely on drush to generate our files. Il works a bit like Drupal Console but we'll need a complete rewrite of our generators. The thing is that the generator dependency is not on the same major version between Drush 10 and Drush 11 so we are not able to create a generator that could work for both of them. As Drush 11 does not support Drupal 8 anymore we want to postpone this change for the next major version of Combawa.

DuaelFr commented 1 year ago

Having tested drush generators a bit, here are some new pros and cons. So drush generators are:

For example, this is how to run a generator command without interaction: drush generate pattern --answer sgp_theme --answer 'Test pattern' --answer test_pattern --answer atoms --answer n --answer n

Maybe we could create a drush command to wrap the generator and still get the named settings but I didn't try yet.

Artusamak commented 1 year ago

Check if https://github.com/Chi-teck/drupal-code-generator could be interesting for us.

Artusamak commented 1 year ago

Note for self: That's what drush generator uses, see comment above for the test. :sparkles:

DuaelFr commented 1 year ago

Drupal Console is outdated and prevents us to upgrade to Drupal 10+\ We need to get rid of it!

Drush Generate do not provide any way to define named parameters so we might have to create a custom command with our needed parameters that calls the generator from the code. This is mandatory for combawa:generate-environment only because it's the only one that really needs a non-interactive alternative. combawa:initialize-build-scripts could only be available in interactive mode.

Artusamak commented 1 year ago

One of Symfony tools for generating boilerplate code is the Maker bundle used through console commands: https://symfony.com/bundles/SymfonyMakerBundle/current/index.html#creating-your-own-makers That's probably where we are heading.

Artusamak commented 1 year ago

One issue to leverage Symfony console is that we can't use it through Drupal 10.x. Last time i checked, the component was incompatible with the repo. So back to the drawing desk.

Artusamak commented 10 months ago

Last step related to this change is to update the documentation. Do we have sections to update?

DuaelFr commented 10 months ago

@Artusamak Thanks for reminiding me. I've seen you already changed most of the README. I just pushed a commit with the remaining references to Drupal Console replaced.