fix: allow matrix testing without EOL versions (#299)

* fix: remove versions dependent on EOL composer 1

* Restore composer 1 versions

* Add `usable` version type, filtered by code constraints

* Added code comment

* Rebuilt index.js with latest changes merged

* Updated documentation
This commit is contained in:
Ryan Hoerr
2025-11-04 19:51:40 -05:00
committed by Damien Retzinger
parent 5fd96b988e
commit 5608271fe3
7 changed files with 105 additions and 37 deletions
+22
View File
@@ -0,0 +1,22 @@
import { PackageMatrixVersion } from '../matrix/matrix-type';
import { getIndividualVersionsForProject } from "../versions/get-versions-for-project";
import semver from 'semver';
export const getUsableVersions = (project: string): string[] => {
const allVersions = getIndividualVersionsForProject(project)
return Object.entries(<Record<string,PackageMatrixVersion>>allVersions)
.filter(([key, value]) => {
/**
* Filter out any versions that are not 'usable', and cannot be successfully installed
* anymore for modern systems or other reasons outside our control.
*/
// Packagist retired support for Composer 1 on 2025-09-01.
if (value.composer && semver.lt(value.composer.toString(), '2.0.0')) {
return false;
}
return true;
})
.map(([key, value]) => key);
}