ecoapm / php-libyear Goto Github PK
View Code? Open in Web Editor NEWA simple measure of dependency freshness
Home Page: https://libyear.com
License: MIT License
A simple measure of dependency freshness
Home Page: https://libyear.com
License: MIT License
No installation instructions are provided in the README.md
I can see mentioning of building a phar, is it not possible to get this installed as a binary in ./vendor/bin using composer or installed globally?
As a user of asset-packagist.org, I want to be able to use libyear
, so that I can keep my back-end managed front-end dependencies up-to-date.
Acceptance criteria:
composer.json
file referencing the repository at https://asset-packagist.org
with dev dependency on npm-asset/xunit.ts
@ v1.4.0 shows the correct information for that packageAs a user, I want to know when an arbitrary age limit is exceeded, so that I can take action on my decrepit app.
Acceptance criteria:
--limit
/-l
cli arg returns exit code 1 if total libyears behind is greater than limit(copied from ecoAPM/dotnet-libyear#82)
When running php-libyear
against a composer.json
file that references a package which is not hosted at packagist.org, but instead is hosted in another composer repository, an uncaught exception is encountered, because the pakagist.org API is returning a 404 when the package's information is asked for. The full error output can be found below, along with a minimal composer.json file (and corresponding lock file) which triggers the error.
I suspect that this same error would be triggered by a composer.json
file which is referencing asset-packagist.org or has a "vcs" or "git" repository configured. Both of those are also contained in the composer.json file where this issue was discovered.
composer.json:
{
"name": "packages/drupal_example",
"description": "A minimal example of a composer manifest that uses the drupal package database",
"repositories": [
{
"type": "composer",
"url": "https://packages.drupal.org/7"
}
],
"require": {
"php": ">=7.1",
"drupal/composer_autoloader": "^1.0"
}
}
composer.lock:
{
"_readme": [
"This file locks the dependencies of your project to a known state",
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "22ef2fdbe0447eeba8c946fec05ea678",
"packages": [
{
"name": "drupal/composer_autoloader",
"version": "1.3.0",
"source": {
"type": "git",
"url": "https://git.drupalcode.org/project/composer_autoloader.git",
"reference": "7.x-1.3"
},
"dist": {
"type": "zip",
"url": "https://ftp.drupal.org/files/projects/composer_autoloader-7.x-1.3.zip",
"reference": "7.x-1.3",
"shasum": "9e5626ade0134d7c2375f724fc359c09648c03c9"
},
"require": {
"drupal/drupal": "~7.0"
},
"conflict": {
"drupal/composer_autoload": "*",
"drupal/composer_manager": "*"
},
"type": "drupal-module",
"extra": {
"branch-alias": {
"dev-1.x": "1.x-dev"
},
"drupal": {
"version": "7.x-1.3",
"datestamp": "1520741884",
"security-coverage": {
"status": "covered",
"message": "Covered by Drupal's security advisory policy"
}
}
},
"notification-url": "https://packages.drupal.org/7/downloads",
"license": [
"GPL-2.0+"
],
"authors": [
{
"name": "davidwbarratt",
"homepage": "https://www.drupal.org/user/411675"
}
],
"description": "Simple module to load the Composer autoload.php file.",
"homepage": "https://www.drupal.org/project/composer_autoloader",
"support": {
"source": "https://git.drupalcode.org/project/composer_autoloader",
"issues": "http://drupal.org/project/issues/composer_autoloader"
}
},
{
"name": "drupal/drupal",
"version": "7.69.0",
"source": {
"type": "git",
"url": "https://git.drupalcode.org/project/drupal.git",
"reference": "7.69"
},
"dist": {
"type": "zip",
"url": "https://ftp.drupal.org/files/projects/drupal-7.69.zip",
"reference": "7.69",
"shasum": "424bbf205fc6f8b28b348d42206b395fca26724f"
},
"type": "drupal-core",
"extra": {
"branch-alias": {
"dev-7.x": "7.x-dev"
},
"drupal": {
"version": "7.69",
"datestamp": "1576698943",
"security-coverage": {
"status": "covered",
"message": "Covered by Drupal's security advisory policy"
}
}
},
"notification-url": "https://packages.drupal.org/7/downloads",
"license": [
"GPL-2.0-or-later"
],
"authors": [
{
"name": "Dries",
"homepage": "https://www.drupal.org/user/1"
},
{
"name": "Drupal",
"homepage": "https://www.drupal.org/user/3"
},
{
"name": "Fabianx",
"homepage": "https://www.drupal.org/user/693738"
},
{
"name": "Gábor Hojtsy",
"homepage": "https://www.drupal.org/user/4166"
},
{
"name": "alexpott",
"homepage": "https://www.drupal.org/user/157725"
},
{
"name": "catch",
"homepage": "https://www.drupal.org/user/35733"
},
{
"name": "cilefen",
"homepage": "https://www.drupal.org/user/1850070"
},
{
"name": "drumm",
"homepage": "https://www.drupal.org/user/3064"
},
{
"name": "effulgentsia",
"homepage": "https://www.drupal.org/user/78040"
},
{
"name": "larowlan",
"homepage": "https://www.drupal.org/user/395439"
},
{
"name": "lauriii",
"homepage": "https://www.drupal.org/user/1078742"
},
{
"name": "mcdruid",
"homepage": "https://www.drupal.org/user/255969"
},
{
"name": "plach",
"homepage": "https://www.drupal.org/user/183211"
},
{
"name": "webchick",
"homepage": "https://www.drupal.org/user/24967"
},
{
"name": "xjm",
"homepage": "https://www.drupal.org/user/65776"
},
{
"name": "yoroy",
"homepage": "https://www.drupal.org/user/41502"
}
],
"homepage": "https://www.drupal.org/project/drupal",
"support": {
"source": "https://git.drupalcode.org/project/drupal"
}
}
],
"packages-dev": [],
"aliases": [],
"minimum-stability": "stable",
"stability-flags": [],
"prefer-stable": false,
"prefer-lowest": false,
"platform": {
"php": ">=7.1"
},
"platform-dev": []
}
Output:
bash-5.0# php libmetrics/LibMetrics.Test/fixtures/php/large/tmp/php-libyear/dist/libyear.phar libmetrics/LibMetrics.Test/fixtures/php/drupal/
Gathering information...
Fatal error: Uncaught GuzzleHttp\Exception\ClientException: Client error: `GET https://repo.packagist.org/packages/drupal/composer_autoloader.json` resulted in a `404 Not Found` response:
{"status":"error","message":"Package not found"}
in phar:///app/libmetrics/LibMetrics.Test/fixtures/php/large/tmp/php-libyear/dist/libyear.phar/vendor/guzzlehttp/guzzle/src/Exception/RequestException.php:113
Stack trace:
#0 phar:///app/libmetrics/LibMetrics.Test/fixtures/php/large/tmp/php-libyear/dist/libyear.phar/vendor/guzzlehttp/guzzle/src/Middleware.php(65): GuzzleHttp\Exception\RequestException::create(Object(GuzzleHttp\Psr7\Request), Object(GuzzleHttp\Psr7\Response))
#1 phar:///app/libmetrics/LibMetrics.Test/fixtures/php/large/tmp/php-libyear/dist/libyear.phar/vendor/guzzlehttp/promises/src/Promise.php(203): GuzzleHttp\Middleware::GuzzleHttp\{closure}(Object(GuzzleHttp\Psr7\Response))
#2 phar:///app/libmetrics/LibMetrics.Test/fixtures/php/large/tmp/php-libyear/dist/libyear.phar/vendor/guzzlehttp/promises/src/Promise.php(156): Guzz in phar:///app/libmetrics/LibMetrics.Test/fixtures/php/large/tmp/php-libyear/dist/libyear.phar/vendor/guzzlehttp/guzzle/src/Exception/RequestException.php on line 113
bash-5.0# exit
With libyear version 2.1.1 and PHP 8.1 I've got the following error:
PHP Warning: Undefined array key "metadata-url" in ~/.config/composer/vendor/ecoapm/libyear/src/RepositoryAPI.php on line 31
PHP Fatal error: Uncaught TypeError: LibYear\Repository::__construct(): Argument #2 ($metadata_pattern) must be of type string, null given, called in ~/.config/composer/vendor/ecoapm/libyear/src/RepositoryAPI.php on line 31 and defined in ~/.config/composer/vendor/ecoapm/libyear/src/Repository.php:10
Stack trace:
#0 ~/.config/composer/vendor/ecoapm/libyear/src/RepositoryAPI.php(31): LibYear\Repository->__construct()
#1 ~/.config/composer/vendor/ecoapm/libyear/src/Calculator.php(27): LibYear\RepositoryAPI->getInfo()
#2 [internal function]: LibYear\Calculator->LibYear\{closure}()
#3 ~/.config/composer/vendor/ecoapm/libyear/src/Calculator.php(27): array_map()
#4 ~/.config/composer/vendor/ecoapm/libyear/src/App.php(70): LibYear\Calculator->getDependencyInfo()
#5 ~/.config/composer/vendor/ecoapm/libyear/src/App.php(35): LibYear\App->getDependencies()
#6 ~/.config/composer/vendor/ecoapm/libyear/libyear(11): LibYear\App->run()
#7 ~/.config/composer/vendor/bin/libyear(120): include('...')
#8 {main}
thrown in ~/.config/composer/vendor/ecoapm/libyear/src/Repository.php on line 10
The url that doesn't have the metadata url is https://asset-packagist.org/packages.json
Was working ok in libyear 2.0.3
As a package maintainer, I want to have a flag that only outputs the number of lib years, so that as a package maintainer I can rank my packages on how far behind they are and decide which to update first.
I'm more than happy to write the PR adding said flag if it is a welcome addition.
As a non-@dependabot user, I want to be able to automatically update all my outdated packages, so that I don't need to do it manually.
Acceptance criteria:
-u
/--update
flag added, which updates the composer.json
file with the latest versions determined by the libyear appcomposer.lock
is not updated (leave this to the required subsequent manualcomposer
call)composer
is not automatically run afterwards (no way to know where it exists)When invoked as php ../php-libyear/libyear.php -q
the output is:
Gathering information...
PHP Warning: file_get_contents(-q/composer.json): failed to open stream:
No such file or directory in /[...]/php-libyear/src/FileSystem.php on line 9
Which makes sense, but also seems a bit odd because leaving out the path is permitted when the -q
flat isn't used.
This is with version c627a34.
the readme doesn't say that php 7.4 is required, and when following the install instructions (just download phar and run with php) it results in a syntax error on anything before 7.4.
maybe this should be part of the readme?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.