diff --git a/src/Composer/Plugin.php b/src/Composer/Plugin.php
index 394283c..b0d3d4d 100644
--- a/src/Composer/Plugin.php
+++ b/src/Composer/Plugin.php
@@ -192,20 +192,25 @@ protected function isInitialInstall(): bool
}
/**
- * Executes `polymer polymer:update` and `polymer-console polymer:update` commands.
- *
- * @throws \Exception
+ * Scaffolds Polymer's project template files on initial install.
*/
protected function executePolymerUpdate(): void
{
if ($this->isInitialInstall()) {
+ // Only initialize within an actual Polymer project, which has a
+ // .polymer directory at its root. When Polymer is pulled in as a
+ // transitive dependency (e.g. an extension package's own CI) there is
+ // nothing to initialize, so skip silently rather than emitting noise
+ // or aborting the composer install.
+ if (!is_dir($this->getRepoRoot() . '/.polymer')) {
+ return;
+ }
$this->io->write('Creating Polymer template files...');
/** @var string $command */
$command = $this->getVendorPath() . '/bin/polymer polymer:init';
$success = $this->executeCommand($command, [], true);
if (!$success) {
- $this->io->writeError("Polymer installation failed! Please execute $command --verbose to debug the issue.");
- throw new \Exception('Installation aborted due to error');
+ $this->io->writeError("Polymer could not initialize project files; skipping. If this is a Polymer project, run $command --verbose to debug.");
}
}
}