Skip to content

Commit

Permalink
fix clear assets
Browse files Browse the repository at this point in the history
  • Loading branch information
zlayine committed Sep 23, 2024
1 parent d38a800 commit a891e43
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 13 deletions.
11 changes: 11 additions & 0 deletions src/Console/InstallPlatformUi.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

use Illuminate\Console\Command;
use Illuminate\Support\Str;
use Illuminate\Support\Facades\File;

class InstallPlatformUi extends Command
{
Expand All @@ -15,6 +16,7 @@ class InstallPlatformUi extends Command
public function handle()
{
$this->resetJSON();
$this->clearPlatformUIAssets();

$this->askForInput('Do you want to enable multi-tenancy? (yes/no)', 'MULTI_TENANCY_VALUE', 'false', 'tenant');
$route = $this->askForInput('Please enter the default route path? (optional)', 'ROUTE_VALUE', '', 'route');
Expand Down Expand Up @@ -109,4 +111,13 @@ private function updateRoute($value)
)
);
}

public function clearPlatformUIAssets()
{
$path = public_path('vendor/platform-ui');

if (File::exists($path)) {
File::deleteDirectory($path);
}
}
}
13 changes: 12 additions & 1 deletion src/Console/RebuildPlatformUi.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
namespace Enjin\PlatformUi\Console;

use Illuminate\Console\Command;
use Illuminate\Support\Str;
use Illuminate\Support\Facades\File;

class RebuildPlatformUi extends Command
{
Expand All @@ -14,6 +14,8 @@ class RebuildPlatformUi extends Command

public function handle()
{
$this->clearPlatformUIAssets();

$this->comment('Installing Platform UI dependencies...');
exec('npm install --prefix ' . $this->BASE_DIR . ' 2> /dev/null');

Expand All @@ -25,4 +27,13 @@ public function handle()

$this->info('Platform UI package Installed successfully.');
}

public function clearPlatformUIAssets()
{
$path = public_path('vendor/platform-ui');

if (File::exists($path)) {
File::deleteDirectory($path);
}
}
}
12 changes: 0 additions & 12 deletions src/PlatformUiServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
use Enjin\PlatformUi\Console\RebuildPlatformUi;
use Spatie\LaravelPackageTools\Package;
use Spatie\LaravelPackageTools\PackageServiceProvider;
use Illuminate\Support\Facades\File;

class PlatformUiServiceProvider extends PackageServiceProvider
{
Expand Down Expand Up @@ -37,20 +36,9 @@ public function boot()

public function defineAssetPublishing()
{
$this->clearPlatformUIAssets();

$this->publishes([
__DIR__ . '/../public' => public_path('vendor/platform-ui'),
__DIR__ . '/../public/images' => public_path('images'),
], ['platform-ui-assets']);
}

public function clearPlatformUIAssets()
{
$path = public_path('vendor/platform-ui');

if (File::exists($path)) {
File::deleteDirectory($path);
}
}
}

0 comments on commit a891e43

Please sign in to comment.