mirror of
				https://github.com/shivammathur/setup-php.git
				synced 2025-10-31 07:16:22 +07:00 
			
		
		
		
	Fix reading composer package type for older versions
This commit is contained in:
		| @ -201,11 +201,15 @@ Function Add-ComposertoolHelper() { | ||||
|     [string] | ||||
|     $composer_args | ||||
|   ) | ||||
|   $tool_version = $release.split(':')[1] | ||||
|   if($NULL -eq $tool_version) { | ||||
|     $tool_version = '*' | ||||
|   } | ||||
|   if($scope -eq 'global') { | ||||
|     if(Test-Path $composer_lock) { | ||||
|       Remove-Item -Path $composer_lock -Force | ||||
|     } | ||||
|     if((composer global show $prefix$tool -a 2>&1 | findstr '^type *: *composer-plugin') -and ($composer_args -ne '')) { | ||||
|     if((composer global show $prefix$tool $tool_version -a 2>&1 | findstr '^type *: *composer-plugin') -and ($composer_args -ne '')) { | ||||
|       composer global config --no-plugins allow-plugins."$prefix$tool" true >$null 2>&1 | ||||
|     } | ||||
|     composer global require $prefix$release $composer_args >$null 2>&1 | ||||
|  | ||||
| @ -160,9 +160,10 @@ add_composertool_helper() { | ||||
|   scope=$4 | ||||
|   composer_args=$5 | ||||
|   enable_extensions curl mbstring openssl | ||||
|   tool_version=${release##*:}; [ "$tool_version" = "$tool" ] && tool_version="*" | ||||
|   if [ "$scope" = "global" ]; then | ||||
|     sudo rm -f "$composer_lock" >/dev/null 2>&1 || true | ||||
|     if composer global show "$prefix$tool" -a 2>&1 | grep -qE '^type *: *composer-plugin' && [ -n "$composer_args" ]; then | ||||
|     if composer global show "$prefix$tool" "$tool_version" -a 2>&1 | grep -qE '^type *: *composer-plugin' && [ -n "$composer_args" ]; then | ||||
|       composer global config --no-plugins allow-plugins."$prefix$tool" true >/dev/null 2>&1 | ||||
|     fi | ||||
|     composer global require "$prefix$release" "$composer_args" >/dev/null 2>&1 | ||||
| @ -172,7 +173,7 @@ add_composertool_helper() { | ||||
|     if ! [ -d "$scoped_dir" ]; then | ||||
|       mkdir -p "$scoped_dir" | ||||
|       echo '{}' | tee "$scoped_dir/composer.json" >/dev/null | ||||
|       if composer show "$prefix$tool" -d "$scoped_dir" -a 2>&1 | grep -qE '^type *: *composer-plugin' && [ -n "$composer_args" ]; then | ||||
|       if composer show "$prefix$tool" "$tool_version" -d "$scoped_dir" -a 2>&1 | grep -qE '^type *: *composer-plugin' && [ -n "$composer_args" ]; then | ||||
|         composer config -d "$scoped_dir" --no-plugins allow-plugins."$prefix$tool" true >/dev/null 2>&1 | ||||
|       fi | ||||
|       composer require "$prefix$release" -d "$scoped_dir" "$composer_args" >/dev/null 2>&1 | ||||
|  | ||||
		Reference in New Issue
	
	Block a user
	 Shivam Mathur
					Shivam Mathur