From 7a0fbc25a842051b566cbf0307680bd951fa3d46 Mon Sep 17 00:00:00 2001 From: lukinovec Date: Mon, 20 Feb 2023 11:06:00 +0100 Subject: [PATCH] Bring back ViteBundler --- assets/config.php | 1 + src/Features/ViteBundler.php | 26 +++++++++++++++++++++++ tests/Features/ViteBundlerTest.php | 34 ++++++++++++++++++++++++++++++ 3 files changed, 61 insertions(+) create mode 100644 src/Features/ViteBundler.php create mode 100644 tests/Features/ViteBundlerTest.php diff --git a/assets/config.php b/assets/config.php index 25811222..7fc6c928 100644 --- a/assets/config.php +++ b/assets/config.php @@ -286,6 +286,7 @@ return [ // Stancl\Tenancy\Features\TelescopeTags::class, // Stancl\Tenancy\Features\TenantConfig::class, // https://tenancyforlaravel.com/docs/v3/features/tenant-config // Stancl\Tenancy\Features\CrossDomainRedirect::class, // https://tenancyforlaravel.com/docs/v3/features/cross-domain-redirect + // Stancl\Tenancy\Features\ViteBundler::class, ], /** diff --git a/src/Features/ViteBundler.php b/src/Features/ViteBundler.php new file mode 100644 index 00000000..e3fee2fa --- /dev/null +++ b/src/Features/ViteBundler.php @@ -0,0 +1,26 @@ +app = $app; + } + + public function bootstrap(Tenancy $tenancy): void + { + $this->app->singleton(\Illuminate\Foundation\Vite::class, Vite::class); + } +} diff --git a/tests/Features/ViteBundlerTest.php b/tests/Features/ViteBundlerTest.php new file mode 100644 index 00000000..23cf164d --- /dev/null +++ b/tests/Features/ViteBundlerTest.php @@ -0,0 +1,34 @@ +assertInstanceOf(\Illuminate\Foundation\Vite::class, $vite); + $this->assertNotInstanceOf(StanclVite::class, $vite); + + config([ + 'tenancy.features' => [ViteBundler::class], + ]); + + $tenant = Tenant::create(); + + tenancy()->initialize($tenant); + + app()->forgetInstance(\Illuminate\Foundation\Vite::class); + + $vite = app(\Illuminate\Foundation\Vite::class); + + $this->assertInstanceOf(StanclVite::class, $vite); + } +}