Adjust filtered composer version

This commit is contained in:
Michele Locati
2020-10-30 11:35:39 +01:00
committed by Shivam Mathur
parent 48f537d6d0
commit 5c4074b01a
3 changed files with 14 additions and 6 deletions

4
dist/index.js vendored
View File

@ -1894,7 +1894,7 @@ exports.getSymfonyUri = getSymfonyUri;
*/
async function addComposer(tools_list) {
const regex_any = /^composer($|:.*)/;
const regex_valid = /^composer:?($|preview$|snapshot$|v?[1-2]$)/;
const regex_valid = /^composer:?($|preview$|snapshot$|v?[1-2]$|v?\d+\.\d+\.\d+[\w-]*$)/;
const regex_composer1_tools = /hirak|prestissimo|narrowspark|composer-prefetcher/;
const matches = tools_list.filter(tool => regex_valid.test(tool));
let composer = 'composer';
@ -1906,7 +1906,7 @@ async function addComposer(tools_list) {
case matches[0] == undefined:
break;
default:
composer = matches[matches.length - 1].replace(/v([1-2])/, '$1');
composer = matches[matches.length - 1].replace(/v(\d\S*)/, '$1');
break;
}
tools_list.unshift(composer);