Skip to content

Commit

Permalink
feat(dev): add library_type component field (#7890)
Browse files Browse the repository at this point in the history
  • Loading branch information
bshaffer authored Dec 11, 2024
1 parent 1df1d9b commit f61bc81
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
9 changes: 8 additions & 1 deletion dev/src/Command/ComponentInfoCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ class ComponentInfoCommand extends Command
'service_address' => 'Service Address',
'api_shortname' => 'API Shortname',
'description' => 'Description',
'library_type' => 'Library Type',
'created_at' => 'Created At',
'available_api_versions' => 'Availble API Versions',
'downloads' => 'Downloads',
Expand All @@ -61,6 +62,11 @@ class ComponentInfoCommand extends Command
'release_level',
'api_shortname',
];
private static $slowFields = [
'available_api_versions',
'created_at',
'downloads',
];

private string $token;
private Packagist $packagist;
Expand Down Expand Up @@ -96,7 +102,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
null => self::$defaultFields,
'all' => array_keys(array_diff_key(
self::$allFields,
['available_api_versions' => '', 'created_at' => '', 'downloads' => '']
array_flip(self::$slowFields)
)),
default => explode(',', $input->getOption('fields')),
};
Expand Down Expand Up @@ -222,6 +228,7 @@ private function getComponentDetailRow(
'service_address' => $package ? $package->getServiceAddress() : implode(",", $component->getServiceAddresses()),
'api_shortname' => $package ? $package->getApiShortname() : implode(",", array_filter($component->getApiShortnames())),
'description' => $component->getDescription(),
'library_type' => $component->getLibraryType(),
'available_api_versions' => null,
'created_at' => null,
'downloads' => null,
Expand Down
7 changes: 7 additions & 0 deletions dev/src/Component.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ class Component
private string $repoName;
private string $productDocumentation;
private string $clientDocumentation;
private string $libraryType;
private string $description;
private array $namespaces;
/** @var array<Component> */
Expand Down Expand Up @@ -113,6 +114,11 @@ public function getProductDocumentation(): string
return $this->productDocumentation;
}

public function getLibraryType(): string
{
return $this->libraryType;
}

public function getDescription(): string
{
return $this->description;
Expand Down Expand Up @@ -219,6 +225,7 @@ private function validateComponentFiles(): void
$this->releaseLevel = $repoMetadataJson['release_level'];
$this->clientDocumentation = $repoMetadataJson['client_documentation'];
$this->productDocumentation = $repoMetadataJson['product_documentation'] ?? '';
$this->libraryType = $repoMetadataJson['library_type'];

$namespaces = [];
foreach ($composerJson['autoload']['psr-4'] as $namespace => $dir) {
Expand Down

0 comments on commit f61bc81

Please sign in to comment.