Skip to content

Commit

Permalink
Really fix on windows
Browse files Browse the repository at this point in the history
  • Loading branch information
tonysm committed Nov 13, 2023
1 parent 7f036cf commit 965f5d3
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/Commands/InstallCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
use Illuminate\Support\Facades\Artisan;
use Illuminate\Support\Facades\Event;
use Illuminate\Support\Facades\File;
use Illuminate\Support\Str;
use Symfony\Component\Console\Terminal;
use Tonysm\ImportmapLaravel\Actions\FixJsImportPaths;
use Tonysm\ImportmapLaravel\Events\FailedToFixImportStatement;
Expand Down Expand Up @@ -62,7 +63,7 @@ private function deleteNpmRelatedFiles(): void
private function publishImportmapFile(): void
{
$this->displayTask('publishing the `routes/importmap.php` file', function () {
File::copy(__DIR__.'/../../stubs/routes/importmap.php', base_path('routes/importmap.php'));
File::copy(dirname(__DIR__, 2).join(DIRECTORY_SEPARATOR, ['', 'stubs', 'routes', 'importmap.php']), base_path(join(DIRECTORY_SEPARATOR, ['routes', 'importmap.php'])));

return self::SUCCESS;
});
Expand All @@ -79,7 +80,7 @@ private function convertLocalImportsFromUsingDots(): void
});

$this->displayTask('converting js imports', function () {
$root = rtrim(resource_path('js'), '/').'/';
$root = rtrim(resource_path('js'), DIRECTORY_SEPARATOR).DIRECTORY_SEPARATOR;

(new FixJsImportPaths($root))();

Expand Down Expand Up @@ -224,6 +225,10 @@ private function displayTask($description, $task)

private function configureIgnoredFolder()
{
if (Str::contains(File::get(base_path('.gitignore')), 'public/js')) {
return;
}

$this->displayTask('dumping & ignoring `public/js` folder', function () {
File::append(
base_path('.gitignore'),
Expand Down

0 comments on commit 965f5d3

Please sign in to comment.