mirror of
https://github.com/pelican-dev/panel.git
synced 2025-11-08 12:29:26 +01:00
try to rebuild assets when installing/ updating plugin
This commit is contained in:
parent
02d18f28e3
commit
a741be7226
@ -15,6 +15,7 @@ use Illuminate\Http\UploadedFile;
|
|||||||
use Illuminate\Support\Composer;
|
use Illuminate\Support\Composer;
|
||||||
use Illuminate\Support\Facades\Artisan;
|
use Illuminate\Support\Facades\Artisan;
|
||||||
use Illuminate\Support\Facades\File;
|
use Illuminate\Support\Facades\File;
|
||||||
|
use Illuminate\Support\Facades\Process;
|
||||||
use Illuminate\Support\ServiceProvider;
|
use Illuminate\Support\ServiceProvider;
|
||||||
use Spatie\TemporaryDirectory\TemporaryDirectory;
|
use Spatie\TemporaryDirectory\TemporaryDirectory;
|
||||||
use ZipArchive;
|
use ZipArchive;
|
||||||
@ -161,6 +162,27 @@ class PluginService
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function buildAssets(): bool
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
$result = Process::run('yarn install');
|
||||||
|
if ($result->failed()) {
|
||||||
|
throw new Exception('Could not install dependencies: ' . $result->errorOutput());
|
||||||
|
}
|
||||||
|
|
||||||
|
$result = Process::run('yarn build');
|
||||||
|
if ($result->failed()) {
|
||||||
|
throw new Exception('Could not build assets: ' . $result->errorOutput());
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
} catch (Exception $exception) {
|
||||||
|
report($exception);
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
public function installPlugin(Plugin $plugin): void
|
public function installPlugin(Plugin $plugin): void
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
@ -168,6 +190,8 @@ class PluginService
|
|||||||
|
|
||||||
$this->runPluginMigrations($plugin);
|
$this->runPluginMigrations($plugin);
|
||||||
|
|
||||||
|
$this->buildAssets();
|
||||||
|
|
||||||
$this->enablePlugin($plugin);
|
$this->enablePlugin($plugin);
|
||||||
} catch (Exception $exception) {
|
} catch (Exception $exception) {
|
||||||
report($exception);
|
report($exception);
|
||||||
@ -185,6 +209,8 @@ class PluginService
|
|||||||
|
|
||||||
$this->runPluginMigrations($plugin);
|
$this->runPluginMigrations($plugin);
|
||||||
|
|
||||||
|
$this->buildAssets();
|
||||||
|
|
||||||
cache()->forget("plugins.$plugin->id.update");
|
cache()->forget("plugins.$plugin->id.update");
|
||||||
} catch (Exception $exception) {
|
} catch (Exception $exception) {
|
||||||
report($exception);
|
report($exception);
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
import { defineConfig } from 'vite';
|
import { defineConfig } from 'vite';
|
||||||
import tailwindcss from '@tailwindcss/vite';
|
import tailwindcss from '@tailwindcss/vite';
|
||||||
import laravel, { refreshPaths } from 'laravel-vite-plugin';
|
import laravel, { refreshPaths } from 'laravel-vite-plugin';
|
||||||
import { globSync } from "glob";
|
import { globSync } from 'glob';
|
||||||
|
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
plugins: [
|
plugins: [
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user