Skip to content

Extract Robo commands into shared gizra/drupal-robo package - #1065

Merged
mariano-dagostino merged 3 commits into
mainfrom
drupal-robo
Sep 16, 2026
Merged

mariano-dagostino merged 3 commits into
mainfrom
drupal-robo

Conversation

@mariano-dagostino

Copy link
Copy Markdown
Collaborator

What

Extracts the Robo command traits from this repo into the new standalone package gizra/drupal-robo (tagged v1.0.0), so every project pulls fixes and improvements from one place with composer update gizra/drupal-robo.

The package is pulled via a Composer VCS repository (no Packagist), so there is nothing to publish — a later move to Packagist would just drop the repositories entry.

Changes here

  • composer.json — add the vcs repository and gizra/drupal-robo: ^1.0 to require-dev.
  • RoboFile.php — compose ProjectConfigTrait and supply the three project-specific values (getThemeName(), getGithubProject(), getInstalledLanguages()); the INSTALLED_LANGUAGES constant is gone.
  • robo-components/ — the 10 shared trait files now live in the package and are deleted here. BootstrapTrait stays (it scaffolds new projects from this template) and is updated to use getThemeBasePath() / getDeploySyncExcludes().

RoboComponents\ autoloads from both the package (src/) and the local robo-components/ (BootstrapTrait) — Composer merges PSR-4 paths for the same namespace.

How it was parameterized

Project-specific values that used to be hardcoded static properties now come from ProjectConfigTrait getters. Three are required (theme name, github project, installed languages); the rest (getThemeBasePath(), getAdminUser(), getPoFilesPath(), getDeploySyncExcludes()) ship with defaults and are only overridden when a project diverges.

Verification

  • ddev robo list — all commands enumerate (project bootstrap:project + package theme:compile, deploy:*, locale:*, pantheon:*, security:*, update:modules, phpcs, …), no fatals.
  • phpcs on RoboFile.php + robo-components/BootstrapTrait.php — clean.
  • phpstan on RoboFile.php + robo-components/ — no errors.
  • Package CI (in the package repo) runs phpcs + phpstan + phpunit on PHP 8.3/8.4.

Follow-up (not in this PR)

  • ddev phpcs no longer sniffs robo-components/ (the package dropped that path). BootstrapTrait was linted manually here; a getPhpcsPaths() getter could restore automatic coverage if wanted.

Move the Robo command traits to the gizra/drupal-robo package (pulled
via a VCS repository) so updates are shared across projects. RoboFile now
supplies project config through ProjectConfigTrait getters instead of the
INSTALLED_LANGUAGES constant. BootstrapTrait stays here as the new-project
scaffolder and is updated to use the config getters.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

@AronNovak AronNovak left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a pending improvement for a while, nice! 👍 How we would do per-project overrides? Can we just have a trait in the derived project to override some parts?

mariano-dagostino and others added 2 commits September 14, 2026 15:09
# Conflicts:
#	robo-components/DeploymentTrait.php
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@mariano-dagostino
mariano-dagostino merged commit b666230 into main Sep 16, 2026
7 checks passed
@mariano-dagostino
mariano-dagostino deleted the drupal-robo branch September 16, 2026 14:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants