Skip to content

Commit 85f4ae6

Browse files
committed
Publish the files
1 parent 9ae61c9 commit 85f4ae6

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

packages/framework/src/Console/Commands/PublishViewsCommand.php

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
namespace Hyde\Console\Commands;
66

77
use Hyde\Console\Concerns\Command;
8+
use Hyde\Facades\Filesystem;
89
use Hyde\Foundation\Providers\ViewServiceProvider;
910
use Hyde\Hyde;
1011
use Illuminate\Support\Collection;
@@ -136,10 +137,16 @@ protected function handleInteractivePublish(): void
136137
// Now we need to prompt the user for which files to publish
137138
$selectedFiles = $this->promptForFiles($files, basename($target));
138139

139-
$this->infoComment(sprintf("Selected files [%s]\n", collect($selectedFiles)->map(fn (string $file): string => Str::after($file, basename($source).'/'))->implode(', ')));
140-
141140
// Now we filter the files to only include the selected ones
142141
$selectedFiles = $files->filter(fn (string $file): bool => in_array($file, $selectedFiles));
142+
143+
// Now we need to publish the selected files
144+
foreach ($selectedFiles as $source => $target) {
145+
Filesystem::ensureDirectoryExists(dirname($target));
146+
Filesystem::copy($source, $target);
147+
}
148+
149+
$this->infoComment(sprintf('Published files [%s]', collect($selectedFiles)->map(fn (string $file): string => Str::after($file, basename($source).'/'))->implode(', ')));
143150
}
144151

145152
protected function promptForFiles(Collection $files, string $baseDir): array

0 commit comments

Comments
 (0)