When finding package versions in the package lock, ncc will try to find a satisfying version rather than the exact version, this is to prevent errors when the package lock contains a version that is not available in the repository.

This commit is contained in:
Netkas 2023-10-13 09:41:39 -04:00
parent 930c206fa9
commit c736a896fb
No known key found for this signature in database
GPG key ID: 5DAF58535614062B
3 changed files with 20 additions and 1 deletions

View file

@ -681,7 +681,14 @@
$path = substr($path, 0, -1);
}
$destination_path .= DIRECTORY_SEPARATOR . hash('crc32', $path);
if($path === '')
{
$destination_path .= DIRECTORY_SEPARATOR . hash('crc32', $project_path);
}
else
{
$destination_path .= DIRECTORY_SEPARATOR . hash('crc32', $path);
}
if(is_file($source_path))
{

View file

@ -259,6 +259,11 @@
{
return $version_entry;
}
if(Semver::satisfies($version_entry->getVersion(), $version))
{
return $version_entry;
}
}
throw new InvalidArgumentException(sprintf('Version %s does not exist in package %s', $version, $this->name));