Closed llaville closed 1 month ago
The Composer Runtime API Composer\InstalledVersions::getPrettyVersion
suffer of local git clone (forks) usage, because it check only on versions
list, excluding the root
entry.
While my fork of your project is installed (via git clone
), I've following vendor/composer/installed.php
file contents :
In such context, we will always have Version: unknown
while an expected good value could be either :
dev-master
dev-master@9252ee58b802328237ebbd4e1decb002823afbb2
(with long commit reference)dev-master@9252ee5
(with short commit reference)And, last but not least, if we want to use your package as a PHAR distribution, we will never know what version is included !
This is the reason why I've adopted myself another approach of Composer Runtime API. For example, on my repo https://github.com/llaville/sarif-php-converters/blob/master/src/Console/Application.php#L40-L62
And at runtime, I got
devilbox@php-8.2.21 in /shared/backups/bartlett/sarif-php-converters $ php report-converter --version
SARIF PHP Converters 1.0.x-dev@cbc5f68
devilbox@php-8.2.21 in /shared/backups/bartlett/sarif-php-converters $ head -12 vendor/composer/installed.php
<?php return array(
'root' => array(
'name' => 'bartlett/sarif-php-converters',
'pretty_version' => '1.0.x-dev',
'version' => '1.0.9999999.9999999-dev',
'reference' => 'cbc5f683983111c335e8c76af87d347a7858e966',
'type' => 'library',
'install_path' => __DIR__ . '/../../',
'aliases' => array(),
'dev' => true,
),
'versions' => array(
Hello,
All CLI applications have an option like this
to be able to know what version we are running. Even PHP CLI runner got it !
It will be very helpfull to add such option.