Skip to content

Don't abort composer install when polymer:init can't run#78

Merged
lpeabody merged 2 commits into
0.xfrom
feature/composer-plugin-resilient-init
Jun 2, 2026
Merged

Don't abort composer install when polymer:init can't run#78
lpeabody merged 2 commits into
0.xfrom
feature/composer-plugin-resilient-init

Conversation

@lpeabody

@lpeabody lpeabody commented Jun 2, 2026

Copy link
Copy Markdown
Contributor

Summary

The Composer plugin scaffolds project files on initial install by running vendor/bin/polymer polymer:init. When Polymer is pulled in as a transitive dependency — e.g. an extension package like polymer-drupal / polymer-pantheon-drupal building in CI — there is no Polymer project to initialize, so bin/polymer exits with "Could not find .polymer directory". The plugin rethrew that as a fatal Installation aborted due to error, breaking composer install outright (this is currently red on digitalpolygon/polymer-drupal#28 and polymer-pantheon-drupal#35).

Scaffolding is a convenience, not a precondition for installing the library, so the plugin now logs a warning and continues instead of aborting the whole install.

Why this surfaced now

With contrib/core moving to the normal vendor/ location (PWT-115), installing Polymer no longer auto-creates a .polymer/ directory, so the post-install polymer:init reliably fails in non-project contexts — which then aborted dependency installs.

Testing

  • PHPStan (level 6) and phpcs clean.
  • Will be confirmed green by the dependent extension PRs' CI once this lands on 0.x and they re-resolve digitalpolygon/polymer:0.x-dev.

🤖 Generated with Claude Code

The Composer plugin scaffolds project files on initial install by shelling out to `polymer polymer:init`. When Polymer is pulled in as a transitive dependency (e.g. an extension package such as polymer-drupal building in CI), there is no Polymer project to initialize and `bin/polymer` exits with "Could not find .polymer directory", which the plugin rethrew as a fatal "Installation aborted" — breaking composer install entirely.

Scaffolding is a convenience, not a hard requirement of installing the library, so log a warning and continue instead of aborting.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Code Review

This pull request modifies the Composer plugin to gracefully handle failures during Polymer project initialization by displaying a warning instead of throwing an exception and aborting the installation. The reviewer suggested an improvement to check for the existence of a .polymer directory before running the initialization command, which would silently skip the process and avoid noisy warning output in transitive dependency contexts.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread src/Composer/Plugin.php Outdated
Check for a .polymer directory before attempting initialization so transitive-dependency installs skip silently instead of printing scaffolding output and a failed-command warning.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@lpeabody
lpeabody merged commit 550bf0d into 0.x Jun 2, 2026
6 checks passed
@lpeabody
lpeabody deleted the feature/composer-plugin-resilient-init branch June 2, 2026 13:57
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.

1 participant