Refactor addPhive in tools.ts

This commit is contained in:
Shivam Mathur 2021-12-13 08:11:59 +05:30
parent 15b20027cf
commit dab0e73adf
No known key found for this signature in database
GPG Key ID: 3E13E4C8591ACC2A
2 changed files with 10 additions and 20 deletions

13
dist/index.js vendored
View File

@ -732,17 +732,12 @@ async function addPhive(data) {
case /7\.2/.test(data['php_version']):
data['version'] = '0.14.5';
break;
}
if (data['version'] === 'latest') {
case /^latest$/.test(data['version']):
data['version'] = await getLatestVersion(data);
break;
}
data['domain'] = [
data['github'],
data['repository'],
'releases/download',
data['version']
].join('/');
data['url'] = await getPharUrl(data);
data['extension'] = '-' + data['version'] + data['extension'];
data['url'] = await getUrl(data);
return await addArchive(data);
}
exports.addPhive = addPhive;

View File

@ -327,17 +327,12 @@ export async function addPhive(data: RS): Promise<string> {
case /7\.2/.test(data['php_version']):
data['version'] = '0.14.5';
break;
}
if (data['version'] === 'latest') {
case /^latest$/.test(data['version']):
data['version'] = await getLatestVersion(data);
break;
}
data['domain'] = [
data['github'],
data['repository'],
'releases/download',
data['version']
].join('/');
data['url'] = await getPharUrl(data);
data['extension'] = '-' + data['version'] + data['extension'];
data['url'] = await getUrl(data);
return await addArchive(data);
}