You are here

protected static function Composer::setTemplateProjectStability in Drupal 10

Same name and namespace in other branches
  1. 9 composer/Composer.php \Drupal\Composer\Composer::setTemplateProjectStability()

Set the stability of the template projects to match the Drupal version.

Parameters

string $root: Path to root of drupal/drupal repository.

string $version: Semver version that Drupal was set to.

Return value

string Stability level of the provided version (stable, RC, alpha, etc.)

1 call to Composer::setTemplateProjectStability()
Composer::setDrupalVersion in composer/Composer.php
Set the version of Drupal; used in release process and by the test suite.

File

composer/Composer.php, line 73

Class

Composer
Provides static functions for composer script events. See also core/lib/Drupal/Composer/Composer.php, which contains similar scripts needed by projects that include drupal/core. Scripts that are only needed by drupal/drupal go here.

Namespace

Drupal\Composer

Code

protected static function setTemplateProjectStability(string $root, string $version) : void {
  $stability = VersionParser::parseStability($version);
  $templateProjectPaths = static::composerSubprojectPaths($root, 'Template');
  foreach ($templateProjectPaths as $path) {
    $dir = dirname($path);
    exec("composer --working-dir={$dir} config minimum-stability {$stability}", $output, $status);
    if ($status) {
      throw new \Exception('Could not set minimum-stability for template project ' . basename($dir));
    }
  }
}