Skip to content

Commit

Permalink
Merge branch '7.x' into 8.x
Browse files Browse the repository at this point in the history
  • Loading branch information
crynobone committed Dec 11, 2024
2 parents c11a823 + f72b6a5 commit 9fd8eef
Showing 1 changed file with 26 additions and 4 deletions.
30 changes: 26 additions & 4 deletions src/Foundation/Console/VendorPublishCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,37 @@ class VendorPublishCommand extends Command
#[\Override]
protected function status($from, $to, $type)
{
$from = str_replace(package_path().'/', '', (string) realpath($from));
$laravelPath = base_path();
$packagePath = package_path();

$to = str_replace(base_path().'/', '', (string) realpath($to));
$pathLocation = function ($path) use ($laravelPath, $packagePath) {
$path = (string) realpath($path);

return match (true) {
str_starts_with($path, $laravelPath) => str_replace("{$laravelPath}/", '@laravel/', $path),
str_starts_with($path, $packagePath) => str_replace("{$packagePath}/", './', $path),
default => $path,
};
};

$fromLocation = $pathLocation($from);
$toLocation = $pathLocation($to);

if (
$type === 'directory' &&
$fromLocation === $toLocation &&
is_link($to)
) {
$this->components->task('Synced directory');

return;
}

$this->components->task(\sprintf(
'Copying %s [%s] to [%s]',
$type,
$from,
$to,
$fromLocation,
$toLocation,
));
}
}

0 comments on commit 9fd8eef

Please sign in to comment.