Fix regression in major/minor.major version support for phpunit

This commit is contained in:
Shivam Mathur 2023-06-13 03:16:19 +05:30
parent 948bd8df3c
commit d2f333de6f
No known key found for this signature in database
GPG Key ID: 3E13E4C8591ACC2A
4 changed files with 16 additions and 3 deletions

3
dist/index.js vendored
View File

@ -946,7 +946,7 @@ exports.addPhive = addPhive;
async function addPHPUnitTools(data) {
if (data['version'] === 'latest') {
data['version'] =
(await packagist.search(data['repository'], data['php_version'])) ??
(await packagist.search(data['packagist'], data['php_version'])) ??
'latest';
}
data['url'] = await getPharUrl(data);
@ -1000,6 +1000,7 @@ async function getData(release, php_version, os) {
data['extension'] ??= '.phar';
data['os'] = os;
data['php_version'] = php_version;
data['packagist'] ??= data['repository'];
data['prefix'] = data['github'] === data['domain'] ? 'releases' : '';
data['verb'] = data['github'] === data['domain'] ? 'download' : '';
data['fetch_latest'] ??= 'false';

View File

@ -267,7 +267,8 @@
},
"phpunit": {
"type": "custom-function",
"repository": "phpunit/phpunit",
"repository": "sebastianbergmann/phpunit",
"packagist": "phpunit/phpunit",
"domain": "https://phar.phpunit.de",
"function": "phpunit",
"version_prefix": "",

View File

@ -13,6 +13,7 @@
"fetch_latest": "true",
"function": "function_name",
"repository": "user/tool",
"packagist": "user/tool",
"scope": "global, scoped",
"type": "phar, composer, custom-package or custom-function",
"version_parameter": "--version",
@ -77,6 +78,15 @@
"user/tool"
]
},
"packagist": {
"$id": "#/items/properties/packagist",
"type": "string",
"title": "The repository schema",
"description": "Packagist repository of the tool in case different from repository.",
"examples": [
"user/tool"
]
},
"scope": {
"$id": "#/items/properties/scope",
"type": "string",

View File

@ -395,7 +395,7 @@ export async function addPhive(data: RS): Promise<string> {
export async function addPHPUnitTools(data: RS): Promise<string> {
if (data['version'] === 'latest') {
data['version'] =
(await packagist.search(data['repository'], data['php_version'])) ??
(await packagist.search(data['packagist'], data['php_version'])) ??
'latest';
}
data['url'] = await getPharUrl(data);
@ -464,6 +464,7 @@ export async function getData(
data['extension'] ??= '.phar';
data['os'] = os;
data['php_version'] = php_version;
data['packagist'] ??= data['repository'];
data['prefix'] = data['github'] === data['domain'] ? 'releases' : '';
data['verb'] = data['github'] === data['domain'] ? 'download' : '';
data['fetch_latest'] ??= 'false';