From 1463ced0bfcf4a87537eaab1b6d32e75492f5a10 Mon Sep 17 00:00:00 2001 From: coolsam726 Date: Mon, 15 Apr 2024 09:07:00 +0000 Subject: [PATCH 01/17] Update CHANGELOG --- CHANGELOG.md | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index d57023c7..eef1238c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,23 @@ All notable changes to `modules` will be documented in this file. +## v4.0.0 - 2024-04-15 + +### What's Changed + +* 4.x dev - Support for nwidart/laravel-modules 11.x by @coolsam726 in https://github.com/savannabits/filament-modules/pull/82 +* Added Version 4.x Documentation by @coolsam726 in https://github.com/savannabits/filament-modules/pull/84 +* README Adjustment: Put the version NOTE below the badges by @coolsam726 in https://github.com/savannabits/filament-modules/pull/86 +* support laravel-modules v11 for laravel 11 by @vellea in https://github.com/savannabits/filament-modules/pull/81 +* Fixed Tests by @coolsam726 in https://github.com/savannabits/filament-modules/pull/87 +* Fix PHP version in phpstan workflow by @coolsam726 in https://github.com/savannabits/filament-modules/pull/88 + +### New Contributors + +* @vellea made their first contribution in https://github.com/savannabits/filament-modules/pull/81 + +**Full Changelog**: https://github.com/savannabits/filament-modules/compare/v3.0.1...v4.0.0 + ## v3.0.1 - 2024-04-15 ### What's Changed From 953f108010afd51deeca110ea515cf83d48e9459 Mon Sep 17 00:00:00 2001 From: coolsam726 Date: Mon, 15 Apr 2024 10:59:28 +0000 Subject: [PATCH 02/17] Fix styling --- src/Commands/ModuleMakeFilamentThemeCommand.php | 10 +++++----- src/Concerns/ModuleFilamentPlugin.php | 8 ++++---- src/ModulesServiceProvider.php | 16 ++++++++-------- 3 files changed, 17 insertions(+), 17 deletions(-) diff --git a/src/Commands/ModuleMakeFilamentThemeCommand.php b/src/Commands/ModuleMakeFilamentThemeCommand.php index b47c908b..c7f03e6b 100644 --- a/src/Commands/ModuleMakeFilamentThemeCommand.php +++ b/src/Commands/ModuleMakeFilamentThemeCommand.php @@ -40,7 +40,7 @@ public function handle(): int 'yarn' => 'yarn add', default => "{$pm} install", }; - $cdCommand = 'cd '.$module->getPath(); + $cdCommand = 'cd ' . $module->getPath(); exec("$cdCommand && {$installCommand} tailwindcss @tailwindcss/forms @tailwindcss/typography postcss postcss-nesting autoprefixer --save-dev"); @@ -66,9 +66,9 @@ public function handle(): int 'viewPathPrefix' => $viewPathPrefix, ]); - $this->components->info('Filament theme [resources/css/filament/theme.css] and [resources/css/filament/tailwind.config.js] created successfully in '.$module->getStudlyName().' module.'); + $this->components->info('Filament theme [resources/css/filament/theme.css] and [resources/css/filament/tailwind.config.js] created successfully in ' . $module->getStudlyName() . ' module.'); - $buildDirectory = 'build-'.$module->getLowerName(); + $buildDirectory = 'build-' . $module->getLowerName(); $moduleStudlyName = $module->getStudlyName(); if (empty(glob($module->getExtraPath('vite.config.*s')))) { @@ -76,7 +76,7 @@ public function handle(): int $this->components->bulletList([ "It looks like you don't have Vite installed in your module. Please use your asset bundling system of choice to compile `resources/css/filament/theme.css` into `public/$buildDirectory/css/filament/theme.css`.", "If you're not currently using a bundler, we recommend using Vite. Alternatively, you can use the Tailwind CLI with the following command inside the $moduleStudlyName module:", - 'npx tailwindcss --input ./resources/css/filament/theme.css --output ./public/'.$buildDirectory.'/css/filament/theme.css --config ./resources/css/filament/tailwind.config.js --minify', + 'npx tailwindcss --input ./resources/css/filament/theme.css --output ./public/' . $buildDirectory . '/css/filament/theme.css --config ./resources/css/filament/tailwind.config.js --minify', "Make sure to register the theme in the {$moduleStudlyName} module plugin under the afterRegister() function using `->theme(asset('css/filament/theme.css'))`", ]); @@ -103,7 +103,7 @@ public function handle(): int protected function getDefaultStubPath(): string { - return __DIR__.'/stubs'; + return __DIR__ . '/stubs'; } private function getModule(): Module diff --git a/src/Concerns/ModuleFilamentPlugin.php b/src/Concerns/ModuleFilamentPlugin.php index a18868fb..abb5214e 100644 --- a/src/Concerns/ModuleFilamentPlugin.php +++ b/src/Concerns/ModuleFilamentPlugin.php @@ -19,15 +19,15 @@ public function register(Panel $panel): void $module = $this->getModule(); $useClusters = config('filament-modules.clusters.enabled', false); $panel->discoverPages( - in: $module->appPath('Filament'.DIRECTORY_SEPARATOR.'Pages'), + in: $module->appPath('Filament' . DIRECTORY_SEPARATOR . 'Pages'), for: $module->appNamespace('\\Filament\\Pages') ); $panel->discoverResources( - in: $module->appPath('Filament'.DIRECTORY_SEPARATOR.'Resources'), + in: $module->appPath('Filament' . DIRECTORY_SEPARATOR . 'Resources'), for: $module->appNamespace('\\Filament\\Resources') ); $panel->discoverWidgets( - in: $module->appPath('Filament'.DIRECTORY_SEPARATOR.'Widgets'), + in: $module->appPath('Filament' . DIRECTORY_SEPARATOR . 'Widgets'), for: $module->appNamespace('\\Filament\\Widgets') ); @@ -37,7 +37,7 @@ public function register(Panel $panel): void ); if ($useClusters) { - $path = $module->appPath('Filament'.DIRECTORY_SEPARATOR.'Clusters'); + $path = $module->appPath('Filament' . DIRECTORY_SEPARATOR . 'Clusters'); $namespace = $module->appNamespace('\\Filament\\Clusters'); $panel->discoverClusters( in: $path, diff --git a/src/ModulesServiceProvider.php b/src/ModulesServiceProvider.php index 0a1ddbdb..0e1f0b33 100644 --- a/src/ModulesServiceProvider.php +++ b/src/ModulesServiceProvider.php @@ -78,7 +78,7 @@ public function packageBooted(): void // Handle Stubs if (app()->runningInConsole()) { - foreach (app(Filesystem::class)->files(__DIR__.'/../stubs/') as $file) { + foreach (app(Filesystem::class)->files(__DIR__ . '/../stubs/') as $file) { $this->publishes([ $file->getRealPath() => base_path("stubs/modules/{$file->getFilename()}"), ], 'modules-stubs'); @@ -171,44 +171,44 @@ protected function registerModuleMacros(): void $relativeNamespace = str_replace('App\\', '', $relativeNamespace); $relativeNamespace = str_replace('App', '', $relativeNamespace); $relativeNamespace = trim($relativeNamespace, '\\'); - $relativeNamespace = '\\'.$relativeNamespace; + $relativeNamespace = '\\' . $relativeNamespace; return $this->namespace($relativeNamespace); }); Module::macro('appPath', function (string $relativePath = '') { $appPath = $this->getExtraPath('app'); - return $appPath.($relativePath ? DIRECTORY_SEPARATOR.$relativePath : ''); + return $appPath . ($relativePath ? DIRECTORY_SEPARATOR . $relativePath : ''); }); Module::macro('databasePath', function (string $relativePath = '') { $appPath = $this->getExtraPath('database'); - return $appPath.($relativePath ? DIRECTORY_SEPARATOR.$relativePath : ''); + return $appPath . ($relativePath ? DIRECTORY_SEPARATOR . $relativePath : ''); }); Module::macro('resourcesPath', function (string $relativePath = '') { $appPath = $this->getExtraPath('resources'); - return $appPath.($relativePath ? DIRECTORY_SEPARATOR.$relativePath : ''); + return $appPath . ($relativePath ? DIRECTORY_SEPARATOR . $relativePath : ''); }); Module::macro('migrationsPath', function (string $relativePath = '') { $appPath = $this->databasePath('migrations'); - return $appPath.($relativePath ? DIRECTORY_SEPARATOR.$relativePath : ''); + return $appPath . ($relativePath ? DIRECTORY_SEPARATOR . $relativePath : ''); }); Module::macro('seedersPath', function (string $relativePath = '') { $appPath = $this->databasePath('seeders'); - return $appPath.($relativePath ? DIRECTORY_SEPARATOR.$relativePath : ''); + return $appPath . ($relativePath ? DIRECTORY_SEPARATOR . $relativePath : ''); }); Module::macro('factoriesPath', function (string $relativePath = '') { $appPath = $this->databasePath('factories'); - return $appPath.($relativePath ? DIRECTORY_SEPARATOR.$relativePath : ''); + return $appPath . ($relativePath ? DIRECTORY_SEPARATOR . $relativePath : ''); }); } } From 4fc54da02765ce4adf32109c1152fa4943c37dbe Mon Sep 17 00:00:00 2001 From: coolsam726 Date: Mon, 15 Apr 2024 11:05:10 +0000 Subject: [PATCH 03/17] Update CHANGELOG --- CHANGELOG.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index eef1238c..38a7cf63 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,15 @@ All notable changes to `modules` will be documented in this file. +## v4.0.1 - 2024-04-15 + +### What's Changed + +* New Feature: A command to generate a Theme inside a module by @coolsam726 in https://github.com/savannabits/filament-modules/pull/89 +* README: Added the Filament Theme command documentation by @coolsam726 in https://github.com/savannabits/filament-modules/pull/90 + +**Full Changelog**: https://github.com/savannabits/filament-modules/compare/v4.0.0...v4.0.1 + ## v4.0.0 - 2024-04-15 ### What's Changed From 2d2a8d3dd15b889b570462bb34dd021c9aa90fd8 Mon Sep 17 00:00:00 2001 From: coolsam726 Date: Tue, 16 Apr 2024 19:25:19 +0000 Subject: [PATCH 04/17] Fix styling --- .../ModuleMakeFilamentThemeCommand.php | 10 ++++----- src/Concerns/ModuleFilamentPlugin.php | 8 +++---- src/ModulesServiceProvider.php | 21 ++++++++++--------- 3 files changed, 20 insertions(+), 19 deletions(-) diff --git a/src/Commands/ModuleMakeFilamentThemeCommand.php b/src/Commands/ModuleMakeFilamentThemeCommand.php index b47c908b..c7f03e6b 100644 --- a/src/Commands/ModuleMakeFilamentThemeCommand.php +++ b/src/Commands/ModuleMakeFilamentThemeCommand.php @@ -40,7 +40,7 @@ public function handle(): int 'yarn' => 'yarn add', default => "{$pm} install", }; - $cdCommand = 'cd '.$module->getPath(); + $cdCommand = 'cd ' . $module->getPath(); exec("$cdCommand && {$installCommand} tailwindcss @tailwindcss/forms @tailwindcss/typography postcss postcss-nesting autoprefixer --save-dev"); @@ -66,9 +66,9 @@ public function handle(): int 'viewPathPrefix' => $viewPathPrefix, ]); - $this->components->info('Filament theme [resources/css/filament/theme.css] and [resources/css/filament/tailwind.config.js] created successfully in '.$module->getStudlyName().' module.'); + $this->components->info('Filament theme [resources/css/filament/theme.css] and [resources/css/filament/tailwind.config.js] created successfully in ' . $module->getStudlyName() . ' module.'); - $buildDirectory = 'build-'.$module->getLowerName(); + $buildDirectory = 'build-' . $module->getLowerName(); $moduleStudlyName = $module->getStudlyName(); if (empty(glob($module->getExtraPath('vite.config.*s')))) { @@ -76,7 +76,7 @@ public function handle(): int $this->components->bulletList([ "It looks like you don't have Vite installed in your module. Please use your asset bundling system of choice to compile `resources/css/filament/theme.css` into `public/$buildDirectory/css/filament/theme.css`.", "If you're not currently using a bundler, we recommend using Vite. Alternatively, you can use the Tailwind CLI with the following command inside the $moduleStudlyName module:", - 'npx tailwindcss --input ./resources/css/filament/theme.css --output ./public/'.$buildDirectory.'/css/filament/theme.css --config ./resources/css/filament/tailwind.config.js --minify', + 'npx tailwindcss --input ./resources/css/filament/theme.css --output ./public/' . $buildDirectory . '/css/filament/theme.css --config ./resources/css/filament/tailwind.config.js --minify', "Make sure to register the theme in the {$moduleStudlyName} module plugin under the afterRegister() function using `->theme(asset('css/filament/theme.css'))`", ]); @@ -103,7 +103,7 @@ public function handle(): int protected function getDefaultStubPath(): string { - return __DIR__.'/stubs'; + return __DIR__ . '/stubs'; } private function getModule(): Module diff --git a/src/Concerns/ModuleFilamentPlugin.php b/src/Concerns/ModuleFilamentPlugin.php index a18868fb..abb5214e 100644 --- a/src/Concerns/ModuleFilamentPlugin.php +++ b/src/Concerns/ModuleFilamentPlugin.php @@ -19,15 +19,15 @@ public function register(Panel $panel): void $module = $this->getModule(); $useClusters = config('filament-modules.clusters.enabled', false); $panel->discoverPages( - in: $module->appPath('Filament'.DIRECTORY_SEPARATOR.'Pages'), + in: $module->appPath('Filament' . DIRECTORY_SEPARATOR . 'Pages'), for: $module->appNamespace('\\Filament\\Pages') ); $panel->discoverResources( - in: $module->appPath('Filament'.DIRECTORY_SEPARATOR.'Resources'), + in: $module->appPath('Filament' . DIRECTORY_SEPARATOR . 'Resources'), for: $module->appNamespace('\\Filament\\Resources') ); $panel->discoverWidgets( - in: $module->appPath('Filament'.DIRECTORY_SEPARATOR.'Widgets'), + in: $module->appPath('Filament' . DIRECTORY_SEPARATOR . 'Widgets'), for: $module->appNamespace('\\Filament\\Widgets') ); @@ -37,7 +37,7 @@ public function register(Panel $panel): void ); if ($useClusters) { - $path = $module->appPath('Filament'.DIRECTORY_SEPARATOR.'Clusters'); + $path = $module->appPath('Filament' . DIRECTORY_SEPARATOR . 'Clusters'); $namespace = $module->appNamespace('\\Filament\\Clusters'); $panel->discoverClusters( in: $path, diff --git a/src/ModulesServiceProvider.php b/src/ModulesServiceProvider.php index ca117581..9583169b 100644 --- a/src/ModulesServiceProvider.php +++ b/src/ModulesServiceProvider.php @@ -64,17 +64,18 @@ public function packageRegistered(): void public function attemptToRegisterModuleProviders(): void { // It is necessary to register them here to avoid late registration (after Panels have already been booted) - $providers = glob(config('modules.paths.modules').'/*/*/Providers/*ServiceProvider.php'); + $providers = glob(config('modules.paths.modules') . '/*/*/Providers/*ServiceProvider.php'); foreach ($providers as $provider) { $namespace = FilamentModules::convertPathToNamespace($provider); $module = str($namespace)->before('\Providers\\')->afterLast('\\')->toString(); $className = str($namespace)->afterLast('\\')->toString(); - if (str($className)->startsWith($module)){ + if (str($className)->startsWith($module)) { // register the module service provider $this->app->register($namespace); } } } + public function packageBooted(): void { $this->attemptToRegisterModuleProviders(); @@ -94,7 +95,7 @@ public function packageBooted(): void // Handle Stubs if (app()->runningInConsole()) { - foreach (app(Filesystem::class)->files(__DIR__.'/../stubs/') as $file) { + foreach (app(Filesystem::class)->files(__DIR__ . '/../stubs/') as $file) { $this->publishes([ $file->getRealPath() => base_path("stubs/modules/{$file->getFilename()}"), ], 'modules-stubs'); @@ -187,44 +188,44 @@ protected function registerModuleMacros(): void $relativeNamespace = str_replace('App\\', '', $relativeNamespace); $relativeNamespace = str_replace('App', '', $relativeNamespace); $relativeNamespace = trim($relativeNamespace, '\\'); - $relativeNamespace = '\\'.$relativeNamespace; + $relativeNamespace = '\\' . $relativeNamespace; return $this->namespace($relativeNamespace); }); Module::macro('appPath', function (string $relativePath = '') { $appPath = $this->getExtraPath('app'); - return $appPath.($relativePath ? DIRECTORY_SEPARATOR.$relativePath : ''); + return $appPath . ($relativePath ? DIRECTORY_SEPARATOR . $relativePath : ''); }); Module::macro('databasePath', function (string $relativePath = '') { $appPath = $this->getExtraPath('database'); - return $appPath.($relativePath ? DIRECTORY_SEPARATOR.$relativePath : ''); + return $appPath . ($relativePath ? DIRECTORY_SEPARATOR . $relativePath : ''); }); Module::macro('resourcesPath', function (string $relativePath = '') { $appPath = $this->getExtraPath('resources'); - return $appPath.($relativePath ? DIRECTORY_SEPARATOR.$relativePath : ''); + return $appPath . ($relativePath ? DIRECTORY_SEPARATOR . $relativePath : ''); }); Module::macro('migrationsPath', function (string $relativePath = '') { $appPath = $this->databasePath('migrations'); - return $appPath.($relativePath ? DIRECTORY_SEPARATOR.$relativePath : ''); + return $appPath . ($relativePath ? DIRECTORY_SEPARATOR . $relativePath : ''); }); Module::macro('seedersPath', function (string $relativePath = '') { $appPath = $this->databasePath('seeders'); - return $appPath.($relativePath ? DIRECTORY_SEPARATOR.$relativePath : ''); + return $appPath . ($relativePath ? DIRECTORY_SEPARATOR . $relativePath : ''); }); Module::macro('factoriesPath', function (string $relativePath = '') { $appPath = $this->databasePath('factories'); - return $appPath.($relativePath ? DIRECTORY_SEPARATOR.$relativePath : ''); + return $appPath . ($relativePath ? DIRECTORY_SEPARATOR . $relativePath : ''); }); } } From 143ad88db2388d539784268c2b50f0038871d3d7 Mon Sep 17 00:00:00 2001 From: coolsam726 Date: Tue, 16 Apr 2024 19:26:33 +0000 Subject: [PATCH 05/17] Update CHANGELOG --- CHANGELOG.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 38a7cf63..8c54aa34 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,14 @@ All notable changes to `modules` will be documented in this file. +## v4.0.2 - 2024-04-16 + +### What's Changed + +* Early Registration of the Main providers for each module. by @coolsam726 in https://github.com/savannabits/filament-modules/pull/91 + +**Full Changelog**: https://github.com/savannabits/filament-modules/compare/v4.0.1...v4.0.2 + ## v4.0.1 - 2024-04-15 ### What's Changed From f3665ca447cb66833e05f80ac5e237be0811e0cc Mon Sep 17 00:00:00 2001 From: coolsam726 Date: Fri, 19 Apr 2024 13:53:00 +0000 Subject: [PATCH 06/17] Fix styling --- .../ModuleMakeFilamentThemeCommand.php | 10 ++++----- src/Concerns/ModuleFilamentPlugin.php | 8 +++---- src/ModulesServiceProvider.php | 21 ++++++++++--------- 3 files changed, 20 insertions(+), 19 deletions(-) diff --git a/src/Commands/ModuleMakeFilamentThemeCommand.php b/src/Commands/ModuleMakeFilamentThemeCommand.php index b47c908b..c7f03e6b 100644 --- a/src/Commands/ModuleMakeFilamentThemeCommand.php +++ b/src/Commands/ModuleMakeFilamentThemeCommand.php @@ -40,7 +40,7 @@ public function handle(): int 'yarn' => 'yarn add', default => "{$pm} install", }; - $cdCommand = 'cd '.$module->getPath(); + $cdCommand = 'cd ' . $module->getPath(); exec("$cdCommand && {$installCommand} tailwindcss @tailwindcss/forms @tailwindcss/typography postcss postcss-nesting autoprefixer --save-dev"); @@ -66,9 +66,9 @@ public function handle(): int 'viewPathPrefix' => $viewPathPrefix, ]); - $this->components->info('Filament theme [resources/css/filament/theme.css] and [resources/css/filament/tailwind.config.js] created successfully in '.$module->getStudlyName().' module.'); + $this->components->info('Filament theme [resources/css/filament/theme.css] and [resources/css/filament/tailwind.config.js] created successfully in ' . $module->getStudlyName() . ' module.'); - $buildDirectory = 'build-'.$module->getLowerName(); + $buildDirectory = 'build-' . $module->getLowerName(); $moduleStudlyName = $module->getStudlyName(); if (empty(glob($module->getExtraPath('vite.config.*s')))) { @@ -76,7 +76,7 @@ public function handle(): int $this->components->bulletList([ "It looks like you don't have Vite installed in your module. Please use your asset bundling system of choice to compile `resources/css/filament/theme.css` into `public/$buildDirectory/css/filament/theme.css`.", "If you're not currently using a bundler, we recommend using Vite. Alternatively, you can use the Tailwind CLI with the following command inside the $moduleStudlyName module:", - 'npx tailwindcss --input ./resources/css/filament/theme.css --output ./public/'.$buildDirectory.'/css/filament/theme.css --config ./resources/css/filament/tailwind.config.js --minify', + 'npx tailwindcss --input ./resources/css/filament/theme.css --output ./public/' . $buildDirectory . '/css/filament/theme.css --config ./resources/css/filament/tailwind.config.js --minify', "Make sure to register the theme in the {$moduleStudlyName} module plugin under the afterRegister() function using `->theme(asset('css/filament/theme.css'))`", ]); @@ -103,7 +103,7 @@ public function handle(): int protected function getDefaultStubPath(): string { - return __DIR__.'/stubs'; + return __DIR__ . '/stubs'; } private function getModule(): Module diff --git a/src/Concerns/ModuleFilamentPlugin.php b/src/Concerns/ModuleFilamentPlugin.php index a18868fb..abb5214e 100644 --- a/src/Concerns/ModuleFilamentPlugin.php +++ b/src/Concerns/ModuleFilamentPlugin.php @@ -19,15 +19,15 @@ public function register(Panel $panel): void $module = $this->getModule(); $useClusters = config('filament-modules.clusters.enabled', false); $panel->discoverPages( - in: $module->appPath('Filament'.DIRECTORY_SEPARATOR.'Pages'), + in: $module->appPath('Filament' . DIRECTORY_SEPARATOR . 'Pages'), for: $module->appNamespace('\\Filament\\Pages') ); $panel->discoverResources( - in: $module->appPath('Filament'.DIRECTORY_SEPARATOR.'Resources'), + in: $module->appPath('Filament' . DIRECTORY_SEPARATOR . 'Resources'), for: $module->appNamespace('\\Filament\\Resources') ); $panel->discoverWidgets( - in: $module->appPath('Filament'.DIRECTORY_SEPARATOR.'Widgets'), + in: $module->appPath('Filament' . DIRECTORY_SEPARATOR . 'Widgets'), for: $module->appNamespace('\\Filament\\Widgets') ); @@ -37,7 +37,7 @@ public function register(Panel $panel): void ); if ($useClusters) { - $path = $module->appPath('Filament'.DIRECTORY_SEPARATOR.'Clusters'); + $path = $module->appPath('Filament' . DIRECTORY_SEPARATOR . 'Clusters'); $namespace = $module->appNamespace('\\Filament\\Clusters'); $panel->discoverClusters( in: $path, diff --git a/src/ModulesServiceProvider.php b/src/ModulesServiceProvider.php index ca117581..9583169b 100644 --- a/src/ModulesServiceProvider.php +++ b/src/ModulesServiceProvider.php @@ -64,17 +64,18 @@ public function packageRegistered(): void public function attemptToRegisterModuleProviders(): void { // It is necessary to register them here to avoid late registration (after Panels have already been booted) - $providers = glob(config('modules.paths.modules').'/*/*/Providers/*ServiceProvider.php'); + $providers = glob(config('modules.paths.modules') . '/*/*/Providers/*ServiceProvider.php'); foreach ($providers as $provider) { $namespace = FilamentModules::convertPathToNamespace($provider); $module = str($namespace)->before('\Providers\\')->afterLast('\\')->toString(); $className = str($namespace)->afterLast('\\')->toString(); - if (str($className)->startsWith($module)){ + if (str($className)->startsWith($module)) { // register the module service provider $this->app->register($namespace); } } } + public function packageBooted(): void { $this->attemptToRegisterModuleProviders(); @@ -94,7 +95,7 @@ public function packageBooted(): void // Handle Stubs if (app()->runningInConsole()) { - foreach (app(Filesystem::class)->files(__DIR__.'/../stubs/') as $file) { + foreach (app(Filesystem::class)->files(__DIR__ . '/../stubs/') as $file) { $this->publishes([ $file->getRealPath() => base_path("stubs/modules/{$file->getFilename()}"), ], 'modules-stubs'); @@ -187,44 +188,44 @@ protected function registerModuleMacros(): void $relativeNamespace = str_replace('App\\', '', $relativeNamespace); $relativeNamespace = str_replace('App', '', $relativeNamespace); $relativeNamespace = trim($relativeNamespace, '\\'); - $relativeNamespace = '\\'.$relativeNamespace; + $relativeNamespace = '\\' . $relativeNamespace; return $this->namespace($relativeNamespace); }); Module::macro('appPath', function (string $relativePath = '') { $appPath = $this->getExtraPath('app'); - return $appPath.($relativePath ? DIRECTORY_SEPARATOR.$relativePath : ''); + return $appPath . ($relativePath ? DIRECTORY_SEPARATOR . $relativePath : ''); }); Module::macro('databasePath', function (string $relativePath = '') { $appPath = $this->getExtraPath('database'); - return $appPath.($relativePath ? DIRECTORY_SEPARATOR.$relativePath : ''); + return $appPath . ($relativePath ? DIRECTORY_SEPARATOR . $relativePath : ''); }); Module::macro('resourcesPath', function (string $relativePath = '') { $appPath = $this->getExtraPath('resources'); - return $appPath.($relativePath ? DIRECTORY_SEPARATOR.$relativePath : ''); + return $appPath . ($relativePath ? DIRECTORY_SEPARATOR . $relativePath : ''); }); Module::macro('migrationsPath', function (string $relativePath = '') { $appPath = $this->databasePath('migrations'); - return $appPath.($relativePath ? DIRECTORY_SEPARATOR.$relativePath : ''); + return $appPath . ($relativePath ? DIRECTORY_SEPARATOR . $relativePath : ''); }); Module::macro('seedersPath', function (string $relativePath = '') { $appPath = $this->databasePath('seeders'); - return $appPath.($relativePath ? DIRECTORY_SEPARATOR.$relativePath : ''); + return $appPath . ($relativePath ? DIRECTORY_SEPARATOR . $relativePath : ''); }); Module::macro('factoriesPath', function (string $relativePath = '') { $appPath = $this->databasePath('factories'); - return $appPath.($relativePath ? DIRECTORY_SEPARATOR.$relativePath : ''); + return $appPath . ($relativePath ? DIRECTORY_SEPARATOR . $relativePath : ''); }); } } From 49971f32b9c1c04b81a3e001b8f940806174afba Mon Sep 17 00:00:00 2001 From: coolsam726 Date: Fri, 19 Apr 2024 14:05:51 +0000 Subject: [PATCH 07/17] Fix styling --- .../ModuleMakeFilamentThemeCommand.php | 10 ++++----- src/Concerns/ModuleFilamentPlugin.php | 8 +++---- src/ModulesServiceProvider.php | 21 ++++++++++--------- 3 files changed, 20 insertions(+), 19 deletions(-) diff --git a/src/Commands/ModuleMakeFilamentThemeCommand.php b/src/Commands/ModuleMakeFilamentThemeCommand.php index b47c908b..c7f03e6b 100644 --- a/src/Commands/ModuleMakeFilamentThemeCommand.php +++ b/src/Commands/ModuleMakeFilamentThemeCommand.php @@ -40,7 +40,7 @@ public function handle(): int 'yarn' => 'yarn add', default => "{$pm} install", }; - $cdCommand = 'cd '.$module->getPath(); + $cdCommand = 'cd ' . $module->getPath(); exec("$cdCommand && {$installCommand} tailwindcss @tailwindcss/forms @tailwindcss/typography postcss postcss-nesting autoprefixer --save-dev"); @@ -66,9 +66,9 @@ public function handle(): int 'viewPathPrefix' => $viewPathPrefix, ]); - $this->components->info('Filament theme [resources/css/filament/theme.css] and [resources/css/filament/tailwind.config.js] created successfully in '.$module->getStudlyName().' module.'); + $this->components->info('Filament theme [resources/css/filament/theme.css] and [resources/css/filament/tailwind.config.js] created successfully in ' . $module->getStudlyName() . ' module.'); - $buildDirectory = 'build-'.$module->getLowerName(); + $buildDirectory = 'build-' . $module->getLowerName(); $moduleStudlyName = $module->getStudlyName(); if (empty(glob($module->getExtraPath('vite.config.*s')))) { @@ -76,7 +76,7 @@ public function handle(): int $this->components->bulletList([ "It looks like you don't have Vite installed in your module. Please use your asset bundling system of choice to compile `resources/css/filament/theme.css` into `public/$buildDirectory/css/filament/theme.css`.", "If you're not currently using a bundler, we recommend using Vite. Alternatively, you can use the Tailwind CLI with the following command inside the $moduleStudlyName module:", - 'npx tailwindcss --input ./resources/css/filament/theme.css --output ./public/'.$buildDirectory.'/css/filament/theme.css --config ./resources/css/filament/tailwind.config.js --minify', + 'npx tailwindcss --input ./resources/css/filament/theme.css --output ./public/' . $buildDirectory . '/css/filament/theme.css --config ./resources/css/filament/tailwind.config.js --minify', "Make sure to register the theme in the {$moduleStudlyName} module plugin under the afterRegister() function using `->theme(asset('css/filament/theme.css'))`", ]); @@ -103,7 +103,7 @@ public function handle(): int protected function getDefaultStubPath(): string { - return __DIR__.'/stubs'; + return __DIR__ . '/stubs'; } private function getModule(): Module diff --git a/src/Concerns/ModuleFilamentPlugin.php b/src/Concerns/ModuleFilamentPlugin.php index a18868fb..abb5214e 100644 --- a/src/Concerns/ModuleFilamentPlugin.php +++ b/src/Concerns/ModuleFilamentPlugin.php @@ -19,15 +19,15 @@ public function register(Panel $panel): void $module = $this->getModule(); $useClusters = config('filament-modules.clusters.enabled', false); $panel->discoverPages( - in: $module->appPath('Filament'.DIRECTORY_SEPARATOR.'Pages'), + in: $module->appPath('Filament' . DIRECTORY_SEPARATOR . 'Pages'), for: $module->appNamespace('\\Filament\\Pages') ); $panel->discoverResources( - in: $module->appPath('Filament'.DIRECTORY_SEPARATOR.'Resources'), + in: $module->appPath('Filament' . DIRECTORY_SEPARATOR . 'Resources'), for: $module->appNamespace('\\Filament\\Resources') ); $panel->discoverWidgets( - in: $module->appPath('Filament'.DIRECTORY_SEPARATOR.'Widgets'), + in: $module->appPath('Filament' . DIRECTORY_SEPARATOR . 'Widgets'), for: $module->appNamespace('\\Filament\\Widgets') ); @@ -37,7 +37,7 @@ public function register(Panel $panel): void ); if ($useClusters) { - $path = $module->appPath('Filament'.DIRECTORY_SEPARATOR.'Clusters'); + $path = $module->appPath('Filament' . DIRECTORY_SEPARATOR . 'Clusters'); $namespace = $module->appNamespace('\\Filament\\Clusters'); $panel->discoverClusters( in: $path, diff --git a/src/ModulesServiceProvider.php b/src/ModulesServiceProvider.php index ca117581..9583169b 100644 --- a/src/ModulesServiceProvider.php +++ b/src/ModulesServiceProvider.php @@ -64,17 +64,18 @@ public function packageRegistered(): void public function attemptToRegisterModuleProviders(): void { // It is necessary to register them here to avoid late registration (after Panels have already been booted) - $providers = glob(config('modules.paths.modules').'/*/*/Providers/*ServiceProvider.php'); + $providers = glob(config('modules.paths.modules') . '/*/*/Providers/*ServiceProvider.php'); foreach ($providers as $provider) { $namespace = FilamentModules::convertPathToNamespace($provider); $module = str($namespace)->before('\Providers\\')->afterLast('\\')->toString(); $className = str($namespace)->afterLast('\\')->toString(); - if (str($className)->startsWith($module)){ + if (str($className)->startsWith($module)) { // register the module service provider $this->app->register($namespace); } } } + public function packageBooted(): void { $this->attemptToRegisterModuleProviders(); @@ -94,7 +95,7 @@ public function packageBooted(): void // Handle Stubs if (app()->runningInConsole()) { - foreach (app(Filesystem::class)->files(__DIR__.'/../stubs/') as $file) { + foreach (app(Filesystem::class)->files(__DIR__ . '/../stubs/') as $file) { $this->publishes([ $file->getRealPath() => base_path("stubs/modules/{$file->getFilename()}"), ], 'modules-stubs'); @@ -187,44 +188,44 @@ protected function registerModuleMacros(): void $relativeNamespace = str_replace('App\\', '', $relativeNamespace); $relativeNamespace = str_replace('App', '', $relativeNamespace); $relativeNamespace = trim($relativeNamespace, '\\'); - $relativeNamespace = '\\'.$relativeNamespace; + $relativeNamespace = '\\' . $relativeNamespace; return $this->namespace($relativeNamespace); }); Module::macro('appPath', function (string $relativePath = '') { $appPath = $this->getExtraPath('app'); - return $appPath.($relativePath ? DIRECTORY_SEPARATOR.$relativePath : ''); + return $appPath . ($relativePath ? DIRECTORY_SEPARATOR . $relativePath : ''); }); Module::macro('databasePath', function (string $relativePath = '') { $appPath = $this->getExtraPath('database'); - return $appPath.($relativePath ? DIRECTORY_SEPARATOR.$relativePath : ''); + return $appPath . ($relativePath ? DIRECTORY_SEPARATOR . $relativePath : ''); }); Module::macro('resourcesPath', function (string $relativePath = '') { $appPath = $this->getExtraPath('resources'); - return $appPath.($relativePath ? DIRECTORY_SEPARATOR.$relativePath : ''); + return $appPath . ($relativePath ? DIRECTORY_SEPARATOR . $relativePath : ''); }); Module::macro('migrationsPath', function (string $relativePath = '') { $appPath = $this->databasePath('migrations'); - return $appPath.($relativePath ? DIRECTORY_SEPARATOR.$relativePath : ''); + return $appPath . ($relativePath ? DIRECTORY_SEPARATOR . $relativePath : ''); }); Module::macro('seedersPath', function (string $relativePath = '') { $appPath = $this->databasePath('seeders'); - return $appPath.($relativePath ? DIRECTORY_SEPARATOR.$relativePath : ''); + return $appPath . ($relativePath ? DIRECTORY_SEPARATOR . $relativePath : ''); }); Module::macro('factoriesPath', function (string $relativePath = '') { $appPath = $this->databasePath('factories'); - return $appPath.($relativePath ? DIRECTORY_SEPARATOR.$relativePath : ''); + return $appPath . ($relativePath ? DIRECTORY_SEPARATOR . $relativePath : ''); }); } } From 35bdd9384a5b29e59b8494f19bea990ef303bbdf Mon Sep 17 00:00:00 2001 From: coolsam726 Date: Fri, 19 Apr 2024 14:16:21 +0000 Subject: [PATCH 08/17] Fix styling --- .../ModuleMakeFilamentThemeCommand.php | 10 ++++----- src/Concerns/ModuleFilamentPlugin.php | 8 +++---- src/ModulesServiceProvider.php | 21 ++++++++++--------- 3 files changed, 20 insertions(+), 19 deletions(-) diff --git a/src/Commands/ModuleMakeFilamentThemeCommand.php b/src/Commands/ModuleMakeFilamentThemeCommand.php index b47c908b..c7f03e6b 100644 --- a/src/Commands/ModuleMakeFilamentThemeCommand.php +++ b/src/Commands/ModuleMakeFilamentThemeCommand.php @@ -40,7 +40,7 @@ public function handle(): int 'yarn' => 'yarn add', default => "{$pm} install", }; - $cdCommand = 'cd '.$module->getPath(); + $cdCommand = 'cd ' . $module->getPath(); exec("$cdCommand && {$installCommand} tailwindcss @tailwindcss/forms @tailwindcss/typography postcss postcss-nesting autoprefixer --save-dev"); @@ -66,9 +66,9 @@ public function handle(): int 'viewPathPrefix' => $viewPathPrefix, ]); - $this->components->info('Filament theme [resources/css/filament/theme.css] and [resources/css/filament/tailwind.config.js] created successfully in '.$module->getStudlyName().' module.'); + $this->components->info('Filament theme [resources/css/filament/theme.css] and [resources/css/filament/tailwind.config.js] created successfully in ' . $module->getStudlyName() . ' module.'); - $buildDirectory = 'build-'.$module->getLowerName(); + $buildDirectory = 'build-' . $module->getLowerName(); $moduleStudlyName = $module->getStudlyName(); if (empty(glob($module->getExtraPath('vite.config.*s')))) { @@ -76,7 +76,7 @@ public function handle(): int $this->components->bulletList([ "It looks like you don't have Vite installed in your module. Please use your asset bundling system of choice to compile `resources/css/filament/theme.css` into `public/$buildDirectory/css/filament/theme.css`.", "If you're not currently using a bundler, we recommend using Vite. Alternatively, you can use the Tailwind CLI with the following command inside the $moduleStudlyName module:", - 'npx tailwindcss --input ./resources/css/filament/theme.css --output ./public/'.$buildDirectory.'/css/filament/theme.css --config ./resources/css/filament/tailwind.config.js --minify', + 'npx tailwindcss --input ./resources/css/filament/theme.css --output ./public/' . $buildDirectory . '/css/filament/theme.css --config ./resources/css/filament/tailwind.config.js --minify', "Make sure to register the theme in the {$moduleStudlyName} module plugin under the afterRegister() function using `->theme(asset('css/filament/theme.css'))`", ]); @@ -103,7 +103,7 @@ public function handle(): int protected function getDefaultStubPath(): string { - return __DIR__.'/stubs'; + return __DIR__ . '/stubs'; } private function getModule(): Module diff --git a/src/Concerns/ModuleFilamentPlugin.php b/src/Concerns/ModuleFilamentPlugin.php index a18868fb..abb5214e 100644 --- a/src/Concerns/ModuleFilamentPlugin.php +++ b/src/Concerns/ModuleFilamentPlugin.php @@ -19,15 +19,15 @@ public function register(Panel $panel): void $module = $this->getModule(); $useClusters = config('filament-modules.clusters.enabled', false); $panel->discoverPages( - in: $module->appPath('Filament'.DIRECTORY_SEPARATOR.'Pages'), + in: $module->appPath('Filament' . DIRECTORY_SEPARATOR . 'Pages'), for: $module->appNamespace('\\Filament\\Pages') ); $panel->discoverResources( - in: $module->appPath('Filament'.DIRECTORY_SEPARATOR.'Resources'), + in: $module->appPath('Filament' . DIRECTORY_SEPARATOR . 'Resources'), for: $module->appNamespace('\\Filament\\Resources') ); $panel->discoverWidgets( - in: $module->appPath('Filament'.DIRECTORY_SEPARATOR.'Widgets'), + in: $module->appPath('Filament' . DIRECTORY_SEPARATOR . 'Widgets'), for: $module->appNamespace('\\Filament\\Widgets') ); @@ -37,7 +37,7 @@ public function register(Panel $panel): void ); if ($useClusters) { - $path = $module->appPath('Filament'.DIRECTORY_SEPARATOR.'Clusters'); + $path = $module->appPath('Filament' . DIRECTORY_SEPARATOR . 'Clusters'); $namespace = $module->appNamespace('\\Filament\\Clusters'); $panel->discoverClusters( in: $path, diff --git a/src/ModulesServiceProvider.php b/src/ModulesServiceProvider.php index ca117581..9583169b 100644 --- a/src/ModulesServiceProvider.php +++ b/src/ModulesServiceProvider.php @@ -64,17 +64,18 @@ public function packageRegistered(): void public function attemptToRegisterModuleProviders(): void { // It is necessary to register them here to avoid late registration (after Panels have already been booted) - $providers = glob(config('modules.paths.modules').'/*/*/Providers/*ServiceProvider.php'); + $providers = glob(config('modules.paths.modules') . '/*/*/Providers/*ServiceProvider.php'); foreach ($providers as $provider) { $namespace = FilamentModules::convertPathToNamespace($provider); $module = str($namespace)->before('\Providers\\')->afterLast('\\')->toString(); $className = str($namespace)->afterLast('\\')->toString(); - if (str($className)->startsWith($module)){ + if (str($className)->startsWith($module)) { // register the module service provider $this->app->register($namespace); } } } + public function packageBooted(): void { $this->attemptToRegisterModuleProviders(); @@ -94,7 +95,7 @@ public function packageBooted(): void // Handle Stubs if (app()->runningInConsole()) { - foreach (app(Filesystem::class)->files(__DIR__.'/../stubs/') as $file) { + foreach (app(Filesystem::class)->files(__DIR__ . '/../stubs/') as $file) { $this->publishes([ $file->getRealPath() => base_path("stubs/modules/{$file->getFilename()}"), ], 'modules-stubs'); @@ -187,44 +188,44 @@ protected function registerModuleMacros(): void $relativeNamespace = str_replace('App\\', '', $relativeNamespace); $relativeNamespace = str_replace('App', '', $relativeNamespace); $relativeNamespace = trim($relativeNamespace, '\\'); - $relativeNamespace = '\\'.$relativeNamespace; + $relativeNamespace = '\\' . $relativeNamespace; return $this->namespace($relativeNamespace); }); Module::macro('appPath', function (string $relativePath = '') { $appPath = $this->getExtraPath('app'); - return $appPath.($relativePath ? DIRECTORY_SEPARATOR.$relativePath : ''); + return $appPath . ($relativePath ? DIRECTORY_SEPARATOR . $relativePath : ''); }); Module::macro('databasePath', function (string $relativePath = '') { $appPath = $this->getExtraPath('database'); - return $appPath.($relativePath ? DIRECTORY_SEPARATOR.$relativePath : ''); + return $appPath . ($relativePath ? DIRECTORY_SEPARATOR . $relativePath : ''); }); Module::macro('resourcesPath', function (string $relativePath = '') { $appPath = $this->getExtraPath('resources'); - return $appPath.($relativePath ? DIRECTORY_SEPARATOR.$relativePath : ''); + return $appPath . ($relativePath ? DIRECTORY_SEPARATOR . $relativePath : ''); }); Module::macro('migrationsPath', function (string $relativePath = '') { $appPath = $this->databasePath('migrations'); - return $appPath.($relativePath ? DIRECTORY_SEPARATOR.$relativePath : ''); + return $appPath . ($relativePath ? DIRECTORY_SEPARATOR . $relativePath : ''); }); Module::macro('seedersPath', function (string $relativePath = '') { $appPath = $this->databasePath('seeders'); - return $appPath.($relativePath ? DIRECTORY_SEPARATOR.$relativePath : ''); + return $appPath . ($relativePath ? DIRECTORY_SEPARATOR . $relativePath : ''); }); Module::macro('factoriesPath', function (string $relativePath = '') { $appPath = $this->databasePath('factories'); - return $appPath.($relativePath ? DIRECTORY_SEPARATOR.$relativePath : ''); + return $appPath . ($relativePath ? DIRECTORY_SEPARATOR . $relativePath : ''); }); } } From ff4082c78392d4e88e70d791e9e13a26ac222561 Mon Sep 17 00:00:00 2001 From: coolsam726 Date: Fri, 19 Apr 2024 14:36:28 +0000 Subject: [PATCH 09/17] Fix styling --- .../ModuleMakeFilamentThemeCommand.php | 10 ++++----- src/Concerns/ModuleFilamentPlugin.php | 8 +++---- src/ModulesServiceProvider.php | 21 ++++++++++--------- 3 files changed, 20 insertions(+), 19 deletions(-) diff --git a/src/Commands/ModuleMakeFilamentThemeCommand.php b/src/Commands/ModuleMakeFilamentThemeCommand.php index b47c908b..c7f03e6b 100644 --- a/src/Commands/ModuleMakeFilamentThemeCommand.php +++ b/src/Commands/ModuleMakeFilamentThemeCommand.php @@ -40,7 +40,7 @@ public function handle(): int 'yarn' => 'yarn add', default => "{$pm} install", }; - $cdCommand = 'cd '.$module->getPath(); + $cdCommand = 'cd ' . $module->getPath(); exec("$cdCommand && {$installCommand} tailwindcss @tailwindcss/forms @tailwindcss/typography postcss postcss-nesting autoprefixer --save-dev"); @@ -66,9 +66,9 @@ public function handle(): int 'viewPathPrefix' => $viewPathPrefix, ]); - $this->components->info('Filament theme [resources/css/filament/theme.css] and [resources/css/filament/tailwind.config.js] created successfully in '.$module->getStudlyName().' module.'); + $this->components->info('Filament theme [resources/css/filament/theme.css] and [resources/css/filament/tailwind.config.js] created successfully in ' . $module->getStudlyName() . ' module.'); - $buildDirectory = 'build-'.$module->getLowerName(); + $buildDirectory = 'build-' . $module->getLowerName(); $moduleStudlyName = $module->getStudlyName(); if (empty(glob($module->getExtraPath('vite.config.*s')))) { @@ -76,7 +76,7 @@ public function handle(): int $this->components->bulletList([ "It looks like you don't have Vite installed in your module. Please use your asset bundling system of choice to compile `resources/css/filament/theme.css` into `public/$buildDirectory/css/filament/theme.css`.", "If you're not currently using a bundler, we recommend using Vite. Alternatively, you can use the Tailwind CLI with the following command inside the $moduleStudlyName module:", - 'npx tailwindcss --input ./resources/css/filament/theme.css --output ./public/'.$buildDirectory.'/css/filament/theme.css --config ./resources/css/filament/tailwind.config.js --minify', + 'npx tailwindcss --input ./resources/css/filament/theme.css --output ./public/' . $buildDirectory . '/css/filament/theme.css --config ./resources/css/filament/tailwind.config.js --minify', "Make sure to register the theme in the {$moduleStudlyName} module plugin under the afterRegister() function using `->theme(asset('css/filament/theme.css'))`", ]); @@ -103,7 +103,7 @@ public function handle(): int protected function getDefaultStubPath(): string { - return __DIR__.'/stubs'; + return __DIR__ . '/stubs'; } private function getModule(): Module diff --git a/src/Concerns/ModuleFilamentPlugin.php b/src/Concerns/ModuleFilamentPlugin.php index a18868fb..abb5214e 100644 --- a/src/Concerns/ModuleFilamentPlugin.php +++ b/src/Concerns/ModuleFilamentPlugin.php @@ -19,15 +19,15 @@ public function register(Panel $panel): void $module = $this->getModule(); $useClusters = config('filament-modules.clusters.enabled', false); $panel->discoverPages( - in: $module->appPath('Filament'.DIRECTORY_SEPARATOR.'Pages'), + in: $module->appPath('Filament' . DIRECTORY_SEPARATOR . 'Pages'), for: $module->appNamespace('\\Filament\\Pages') ); $panel->discoverResources( - in: $module->appPath('Filament'.DIRECTORY_SEPARATOR.'Resources'), + in: $module->appPath('Filament' . DIRECTORY_SEPARATOR . 'Resources'), for: $module->appNamespace('\\Filament\\Resources') ); $panel->discoverWidgets( - in: $module->appPath('Filament'.DIRECTORY_SEPARATOR.'Widgets'), + in: $module->appPath('Filament' . DIRECTORY_SEPARATOR . 'Widgets'), for: $module->appNamespace('\\Filament\\Widgets') ); @@ -37,7 +37,7 @@ public function register(Panel $panel): void ); if ($useClusters) { - $path = $module->appPath('Filament'.DIRECTORY_SEPARATOR.'Clusters'); + $path = $module->appPath('Filament' . DIRECTORY_SEPARATOR . 'Clusters'); $namespace = $module->appNamespace('\\Filament\\Clusters'); $panel->discoverClusters( in: $path, diff --git a/src/ModulesServiceProvider.php b/src/ModulesServiceProvider.php index ca117581..9583169b 100644 --- a/src/ModulesServiceProvider.php +++ b/src/ModulesServiceProvider.php @@ -64,17 +64,18 @@ public function packageRegistered(): void public function attemptToRegisterModuleProviders(): void { // It is necessary to register them here to avoid late registration (after Panels have already been booted) - $providers = glob(config('modules.paths.modules').'/*/*/Providers/*ServiceProvider.php'); + $providers = glob(config('modules.paths.modules') . '/*/*/Providers/*ServiceProvider.php'); foreach ($providers as $provider) { $namespace = FilamentModules::convertPathToNamespace($provider); $module = str($namespace)->before('\Providers\\')->afterLast('\\')->toString(); $className = str($namespace)->afterLast('\\')->toString(); - if (str($className)->startsWith($module)){ + if (str($className)->startsWith($module)) { // register the module service provider $this->app->register($namespace); } } } + public function packageBooted(): void { $this->attemptToRegisterModuleProviders(); @@ -94,7 +95,7 @@ public function packageBooted(): void // Handle Stubs if (app()->runningInConsole()) { - foreach (app(Filesystem::class)->files(__DIR__.'/../stubs/') as $file) { + foreach (app(Filesystem::class)->files(__DIR__ . '/../stubs/') as $file) { $this->publishes([ $file->getRealPath() => base_path("stubs/modules/{$file->getFilename()}"), ], 'modules-stubs'); @@ -187,44 +188,44 @@ protected function registerModuleMacros(): void $relativeNamespace = str_replace('App\\', '', $relativeNamespace); $relativeNamespace = str_replace('App', '', $relativeNamespace); $relativeNamespace = trim($relativeNamespace, '\\'); - $relativeNamespace = '\\'.$relativeNamespace; + $relativeNamespace = '\\' . $relativeNamespace; return $this->namespace($relativeNamespace); }); Module::macro('appPath', function (string $relativePath = '') { $appPath = $this->getExtraPath('app'); - return $appPath.($relativePath ? DIRECTORY_SEPARATOR.$relativePath : ''); + return $appPath . ($relativePath ? DIRECTORY_SEPARATOR . $relativePath : ''); }); Module::macro('databasePath', function (string $relativePath = '') { $appPath = $this->getExtraPath('database'); - return $appPath.($relativePath ? DIRECTORY_SEPARATOR.$relativePath : ''); + return $appPath . ($relativePath ? DIRECTORY_SEPARATOR . $relativePath : ''); }); Module::macro('resourcesPath', function (string $relativePath = '') { $appPath = $this->getExtraPath('resources'); - return $appPath.($relativePath ? DIRECTORY_SEPARATOR.$relativePath : ''); + return $appPath . ($relativePath ? DIRECTORY_SEPARATOR . $relativePath : ''); }); Module::macro('migrationsPath', function (string $relativePath = '') { $appPath = $this->databasePath('migrations'); - return $appPath.($relativePath ? DIRECTORY_SEPARATOR.$relativePath : ''); + return $appPath . ($relativePath ? DIRECTORY_SEPARATOR . $relativePath : ''); }); Module::macro('seedersPath', function (string $relativePath = '') { $appPath = $this->databasePath('seeders'); - return $appPath.($relativePath ? DIRECTORY_SEPARATOR.$relativePath : ''); + return $appPath . ($relativePath ? DIRECTORY_SEPARATOR . $relativePath : ''); }); Module::macro('factoriesPath', function (string $relativePath = '') { $appPath = $this->databasePath('factories'); - return $appPath.($relativePath ? DIRECTORY_SEPARATOR.$relativePath : ''); + return $appPath . ($relativePath ? DIRECTORY_SEPARATOR . $relativePath : ''); }); } } From cd85944de382cebe4dd1ecdf0bb674147fa7ca52 Mon Sep 17 00:00:00 2001 From: coolsam726 Date: Fri, 19 Apr 2024 14:47:16 +0000 Subject: [PATCH 10/17] Fix styling --- src/Commands/ModuleMakeFilamentThemeCommand.php | 10 +++++----- src/Concerns/ModuleFilamentPlugin.php | 8 ++++---- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/Commands/ModuleMakeFilamentThemeCommand.php b/src/Commands/ModuleMakeFilamentThemeCommand.php index b47c908b..c7f03e6b 100644 --- a/src/Commands/ModuleMakeFilamentThemeCommand.php +++ b/src/Commands/ModuleMakeFilamentThemeCommand.php @@ -40,7 +40,7 @@ public function handle(): int 'yarn' => 'yarn add', default => "{$pm} install", }; - $cdCommand = 'cd '.$module->getPath(); + $cdCommand = 'cd ' . $module->getPath(); exec("$cdCommand && {$installCommand} tailwindcss @tailwindcss/forms @tailwindcss/typography postcss postcss-nesting autoprefixer --save-dev"); @@ -66,9 +66,9 @@ public function handle(): int 'viewPathPrefix' => $viewPathPrefix, ]); - $this->components->info('Filament theme [resources/css/filament/theme.css] and [resources/css/filament/tailwind.config.js] created successfully in '.$module->getStudlyName().' module.'); + $this->components->info('Filament theme [resources/css/filament/theme.css] and [resources/css/filament/tailwind.config.js] created successfully in ' . $module->getStudlyName() . ' module.'); - $buildDirectory = 'build-'.$module->getLowerName(); + $buildDirectory = 'build-' . $module->getLowerName(); $moduleStudlyName = $module->getStudlyName(); if (empty(glob($module->getExtraPath('vite.config.*s')))) { @@ -76,7 +76,7 @@ public function handle(): int $this->components->bulletList([ "It looks like you don't have Vite installed in your module. Please use your asset bundling system of choice to compile `resources/css/filament/theme.css` into `public/$buildDirectory/css/filament/theme.css`.", "If you're not currently using a bundler, we recommend using Vite. Alternatively, you can use the Tailwind CLI with the following command inside the $moduleStudlyName module:", - 'npx tailwindcss --input ./resources/css/filament/theme.css --output ./public/'.$buildDirectory.'/css/filament/theme.css --config ./resources/css/filament/tailwind.config.js --minify', + 'npx tailwindcss --input ./resources/css/filament/theme.css --output ./public/' . $buildDirectory . '/css/filament/theme.css --config ./resources/css/filament/tailwind.config.js --minify', "Make sure to register the theme in the {$moduleStudlyName} module plugin under the afterRegister() function using `->theme(asset('css/filament/theme.css'))`", ]); @@ -103,7 +103,7 @@ public function handle(): int protected function getDefaultStubPath(): string { - return __DIR__.'/stubs'; + return __DIR__ . '/stubs'; } private function getModule(): Module diff --git a/src/Concerns/ModuleFilamentPlugin.php b/src/Concerns/ModuleFilamentPlugin.php index a18868fb..abb5214e 100644 --- a/src/Concerns/ModuleFilamentPlugin.php +++ b/src/Concerns/ModuleFilamentPlugin.php @@ -19,15 +19,15 @@ public function register(Panel $panel): void $module = $this->getModule(); $useClusters = config('filament-modules.clusters.enabled', false); $panel->discoverPages( - in: $module->appPath('Filament'.DIRECTORY_SEPARATOR.'Pages'), + in: $module->appPath('Filament' . DIRECTORY_SEPARATOR . 'Pages'), for: $module->appNamespace('\\Filament\\Pages') ); $panel->discoverResources( - in: $module->appPath('Filament'.DIRECTORY_SEPARATOR.'Resources'), + in: $module->appPath('Filament' . DIRECTORY_SEPARATOR . 'Resources'), for: $module->appNamespace('\\Filament\\Resources') ); $panel->discoverWidgets( - in: $module->appPath('Filament'.DIRECTORY_SEPARATOR.'Widgets'), + in: $module->appPath('Filament' . DIRECTORY_SEPARATOR . 'Widgets'), for: $module->appNamespace('\\Filament\\Widgets') ); @@ -37,7 +37,7 @@ public function register(Panel $panel): void ); if ($useClusters) { - $path = $module->appPath('Filament'.DIRECTORY_SEPARATOR.'Clusters'); + $path = $module->appPath('Filament' . DIRECTORY_SEPARATOR . 'Clusters'); $namespace = $module->appNamespace('\\Filament\\Clusters'); $panel->discoverClusters( in: $path, From 71ad0fb9e8eb9b189219400ab81d8f69f53bf174 Mon Sep 17 00:00:00 2001 From: coolsam726 Date: Fri, 19 Apr 2024 14:56:36 +0000 Subject: [PATCH 11/17] Update CHANGELOG --- CHANGELOG.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8c54aa34..e8e10183 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,18 @@ All notable changes to `modules` will be documented in this file. +## v4.0.3 - 2024-04-19 + +### What's Changed + +* New Test: Testing the convertPathToNamespace helper method by @coolsam726 in https://github.com/savannabits/filament-modules/pull/93 +* Attempt 1 to fix the `convertPathToNamespace` helper by @coolsam726 in https://github.com/savannabits/filament-modules/pull/94 +* Attempt 2: Test if convertPathToNamespace is fixed by @coolsam726 in https://github.com/savannabits/filament-modules/pull/95 +* Attempt 3: To Fix convertPathToNamespace for windows platform by @coolsam726 in https://github.com/savannabits/filament-modules/pull/96 +* Bug Fix: Registering Module Service Providers was not working on windows by @coolsam726 in https://github.com/savannabits/filament-modules/pull/97 - Fixes #92 + +**Full Changelog**: https://github.com/savannabits/filament-modules/compare/v4.0.2...v4.0.3 + ## v4.0.2 - 2024-04-16 ### What's Changed From 9798b19423fdf3e80b90add0511f6a5649328e0d Mon Sep 17 00:00:00 2001 From: coolsam726 Date: Sat, 20 Apr 2024 07:22:01 +0000 Subject: [PATCH 12/17] Fix styling --- src/Commands/ModuleMakeFilamentPageCommand.php | 2 +- src/Commands/ModuleMakeFilamentThemeCommand.php | 10 +++++----- src/Concerns/ModuleFilamentPlugin.php | 8 ++++---- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/Commands/ModuleMakeFilamentPageCommand.php b/src/Commands/ModuleMakeFilamentPageCommand.php index 9c3d5447..d4724e77 100644 --- a/src/Commands/ModuleMakeFilamentPageCommand.php +++ b/src/Commands/ModuleMakeFilamentPageCommand.php @@ -239,7 +239,7 @@ public function handle(): int (string) str($view) ->replace($module->getLowerName() . '::', '') ->replace('.', DIRECTORY_SEPARATOR) - ->prepend('views'.DIRECTORY_SEPARATOR) + ->prepend('views' . DIRECTORY_SEPARATOR) ->append('.blade.php'), ); diff --git a/src/Commands/ModuleMakeFilamentThemeCommand.php b/src/Commands/ModuleMakeFilamentThemeCommand.php index b47c908b..c7f03e6b 100644 --- a/src/Commands/ModuleMakeFilamentThemeCommand.php +++ b/src/Commands/ModuleMakeFilamentThemeCommand.php @@ -40,7 +40,7 @@ public function handle(): int 'yarn' => 'yarn add', default => "{$pm} install", }; - $cdCommand = 'cd '.$module->getPath(); + $cdCommand = 'cd ' . $module->getPath(); exec("$cdCommand && {$installCommand} tailwindcss @tailwindcss/forms @tailwindcss/typography postcss postcss-nesting autoprefixer --save-dev"); @@ -66,9 +66,9 @@ public function handle(): int 'viewPathPrefix' => $viewPathPrefix, ]); - $this->components->info('Filament theme [resources/css/filament/theme.css] and [resources/css/filament/tailwind.config.js] created successfully in '.$module->getStudlyName().' module.'); + $this->components->info('Filament theme [resources/css/filament/theme.css] and [resources/css/filament/tailwind.config.js] created successfully in ' . $module->getStudlyName() . ' module.'); - $buildDirectory = 'build-'.$module->getLowerName(); + $buildDirectory = 'build-' . $module->getLowerName(); $moduleStudlyName = $module->getStudlyName(); if (empty(glob($module->getExtraPath('vite.config.*s')))) { @@ -76,7 +76,7 @@ public function handle(): int $this->components->bulletList([ "It looks like you don't have Vite installed in your module. Please use your asset bundling system of choice to compile `resources/css/filament/theme.css` into `public/$buildDirectory/css/filament/theme.css`.", "If you're not currently using a bundler, we recommend using Vite. Alternatively, you can use the Tailwind CLI with the following command inside the $moduleStudlyName module:", - 'npx tailwindcss --input ./resources/css/filament/theme.css --output ./public/'.$buildDirectory.'/css/filament/theme.css --config ./resources/css/filament/tailwind.config.js --minify', + 'npx tailwindcss --input ./resources/css/filament/theme.css --output ./public/' . $buildDirectory . '/css/filament/theme.css --config ./resources/css/filament/tailwind.config.js --minify', "Make sure to register the theme in the {$moduleStudlyName} module plugin under the afterRegister() function using `->theme(asset('css/filament/theme.css'))`", ]); @@ -103,7 +103,7 @@ public function handle(): int protected function getDefaultStubPath(): string { - return __DIR__.'/stubs'; + return __DIR__ . '/stubs'; } private function getModule(): Module diff --git a/src/Concerns/ModuleFilamentPlugin.php b/src/Concerns/ModuleFilamentPlugin.php index a18868fb..abb5214e 100644 --- a/src/Concerns/ModuleFilamentPlugin.php +++ b/src/Concerns/ModuleFilamentPlugin.php @@ -19,15 +19,15 @@ public function register(Panel $panel): void $module = $this->getModule(); $useClusters = config('filament-modules.clusters.enabled', false); $panel->discoverPages( - in: $module->appPath('Filament'.DIRECTORY_SEPARATOR.'Pages'), + in: $module->appPath('Filament' . DIRECTORY_SEPARATOR . 'Pages'), for: $module->appNamespace('\\Filament\\Pages') ); $panel->discoverResources( - in: $module->appPath('Filament'.DIRECTORY_SEPARATOR.'Resources'), + in: $module->appPath('Filament' . DIRECTORY_SEPARATOR . 'Resources'), for: $module->appNamespace('\\Filament\\Resources') ); $panel->discoverWidgets( - in: $module->appPath('Filament'.DIRECTORY_SEPARATOR.'Widgets'), + in: $module->appPath('Filament' . DIRECTORY_SEPARATOR . 'Widgets'), for: $module->appNamespace('\\Filament\\Widgets') ); @@ -37,7 +37,7 @@ public function register(Panel $panel): void ); if ($useClusters) { - $path = $module->appPath('Filament'.DIRECTORY_SEPARATOR.'Clusters'); + $path = $module->appPath('Filament' . DIRECTORY_SEPARATOR . 'Clusters'); $namespace = $module->appNamespace('\\Filament\\Clusters'); $panel->discoverClusters( in: $path, From 0a20cbf5878fe6319c7b946b1b32f92b4ea83c27 Mon Sep 17 00:00:00 2001 From: coolsam726 Date: Sat, 20 Apr 2024 07:25:11 +0000 Subject: [PATCH 13/17] Update CHANGELOG --- CHANGELOG.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index e8e10183..98932cf1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,14 @@ All notable changes to `modules` will be documented in this file. +## v4.0.4 - 2024-04-20 + +### What's Changed + +* Bug Fix: Wrong Directory Separators causing errors when registering Module Plugins by @coolsam726 in https://github.com/savannabits/filament-modules/pull/98 + +**Full Changelog**: https://github.com/savannabits/filament-modules/compare/v4.0.3...v4.0.4 + ## v4.0.3 - 2024-04-19 ### What's Changed From d60cc80bda7e761a94b50a8acaf8f1761f41dce4 Mon Sep 17 00:00:00 2001 From: coolsam726 Date: Sat, 20 Apr 2024 07:31:02 +0000 Subject: [PATCH 14/17] Fix styling --- src/Commands/ModuleMakeFilamentPageCommand.php | 2 +- src/Commands/ModuleMakeFilamentThemeCommand.php | 10 +++++----- src/Concerns/ModuleFilamentPlugin.php | 8 ++++---- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/Commands/ModuleMakeFilamentPageCommand.php b/src/Commands/ModuleMakeFilamentPageCommand.php index 9c3d5447..d4724e77 100644 --- a/src/Commands/ModuleMakeFilamentPageCommand.php +++ b/src/Commands/ModuleMakeFilamentPageCommand.php @@ -239,7 +239,7 @@ public function handle(): int (string) str($view) ->replace($module->getLowerName() . '::', '') ->replace('.', DIRECTORY_SEPARATOR) - ->prepend('views'.DIRECTORY_SEPARATOR) + ->prepend('views' . DIRECTORY_SEPARATOR) ->append('.blade.php'), ); diff --git a/src/Commands/ModuleMakeFilamentThemeCommand.php b/src/Commands/ModuleMakeFilamentThemeCommand.php index b47c908b..c7f03e6b 100644 --- a/src/Commands/ModuleMakeFilamentThemeCommand.php +++ b/src/Commands/ModuleMakeFilamentThemeCommand.php @@ -40,7 +40,7 @@ public function handle(): int 'yarn' => 'yarn add', default => "{$pm} install", }; - $cdCommand = 'cd '.$module->getPath(); + $cdCommand = 'cd ' . $module->getPath(); exec("$cdCommand && {$installCommand} tailwindcss @tailwindcss/forms @tailwindcss/typography postcss postcss-nesting autoprefixer --save-dev"); @@ -66,9 +66,9 @@ public function handle(): int 'viewPathPrefix' => $viewPathPrefix, ]); - $this->components->info('Filament theme [resources/css/filament/theme.css] and [resources/css/filament/tailwind.config.js] created successfully in '.$module->getStudlyName().' module.'); + $this->components->info('Filament theme [resources/css/filament/theme.css] and [resources/css/filament/tailwind.config.js] created successfully in ' . $module->getStudlyName() . ' module.'); - $buildDirectory = 'build-'.$module->getLowerName(); + $buildDirectory = 'build-' . $module->getLowerName(); $moduleStudlyName = $module->getStudlyName(); if (empty(glob($module->getExtraPath('vite.config.*s')))) { @@ -76,7 +76,7 @@ public function handle(): int $this->components->bulletList([ "It looks like you don't have Vite installed in your module. Please use your asset bundling system of choice to compile `resources/css/filament/theme.css` into `public/$buildDirectory/css/filament/theme.css`.", "If you're not currently using a bundler, we recommend using Vite. Alternatively, you can use the Tailwind CLI with the following command inside the $moduleStudlyName module:", - 'npx tailwindcss --input ./resources/css/filament/theme.css --output ./public/'.$buildDirectory.'/css/filament/theme.css --config ./resources/css/filament/tailwind.config.js --minify', + 'npx tailwindcss --input ./resources/css/filament/theme.css --output ./public/' . $buildDirectory . '/css/filament/theme.css --config ./resources/css/filament/tailwind.config.js --minify', "Make sure to register the theme in the {$moduleStudlyName} module plugin under the afterRegister() function using `->theme(asset('css/filament/theme.css'))`", ]); @@ -103,7 +103,7 @@ public function handle(): int protected function getDefaultStubPath(): string { - return __DIR__.'/stubs'; + return __DIR__ . '/stubs'; } private function getModule(): Module diff --git a/src/Concerns/ModuleFilamentPlugin.php b/src/Concerns/ModuleFilamentPlugin.php index a18868fb..abb5214e 100644 --- a/src/Concerns/ModuleFilamentPlugin.php +++ b/src/Concerns/ModuleFilamentPlugin.php @@ -19,15 +19,15 @@ public function register(Panel $panel): void $module = $this->getModule(); $useClusters = config('filament-modules.clusters.enabled', false); $panel->discoverPages( - in: $module->appPath('Filament'.DIRECTORY_SEPARATOR.'Pages'), + in: $module->appPath('Filament' . DIRECTORY_SEPARATOR . 'Pages'), for: $module->appNamespace('\\Filament\\Pages') ); $panel->discoverResources( - in: $module->appPath('Filament'.DIRECTORY_SEPARATOR.'Resources'), + in: $module->appPath('Filament' . DIRECTORY_SEPARATOR . 'Resources'), for: $module->appNamespace('\\Filament\\Resources') ); $panel->discoverWidgets( - in: $module->appPath('Filament'.DIRECTORY_SEPARATOR.'Widgets'), + in: $module->appPath('Filament' . DIRECTORY_SEPARATOR . 'Widgets'), for: $module->appNamespace('\\Filament\\Widgets') ); @@ -37,7 +37,7 @@ public function register(Panel $panel): void ); if ($useClusters) { - $path = $module->appPath('Filament'.DIRECTORY_SEPARATOR.'Clusters'); + $path = $module->appPath('Filament' . DIRECTORY_SEPARATOR . 'Clusters'); $namespace = $module->appNamespace('\\Filament\\Clusters'); $panel->discoverClusters( in: $path, From 8867c3e0df706e88f055bb1dcadb2021a70510f3 Mon Sep 17 00:00:00 2001 From: coolsam726 Date: Sat, 20 Apr 2024 07:44:40 +0000 Subject: [PATCH 15/17] Fix styling --- src/Commands/ModuleMakeFilamentPageCommand.php | 2 +- src/Commands/ModuleMakeFilamentThemeCommand.php | 10 +++++----- src/Concerns/ModuleFilamentPlugin.php | 8 ++++---- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/Commands/ModuleMakeFilamentPageCommand.php b/src/Commands/ModuleMakeFilamentPageCommand.php index 9c3d5447..d4724e77 100644 --- a/src/Commands/ModuleMakeFilamentPageCommand.php +++ b/src/Commands/ModuleMakeFilamentPageCommand.php @@ -239,7 +239,7 @@ public function handle(): int (string) str($view) ->replace($module->getLowerName() . '::', '') ->replace('.', DIRECTORY_SEPARATOR) - ->prepend('views'.DIRECTORY_SEPARATOR) + ->prepend('views' . DIRECTORY_SEPARATOR) ->append('.blade.php'), ); diff --git a/src/Commands/ModuleMakeFilamentThemeCommand.php b/src/Commands/ModuleMakeFilamentThemeCommand.php index b47c908b..c7f03e6b 100644 --- a/src/Commands/ModuleMakeFilamentThemeCommand.php +++ b/src/Commands/ModuleMakeFilamentThemeCommand.php @@ -40,7 +40,7 @@ public function handle(): int 'yarn' => 'yarn add', default => "{$pm} install", }; - $cdCommand = 'cd '.$module->getPath(); + $cdCommand = 'cd ' . $module->getPath(); exec("$cdCommand && {$installCommand} tailwindcss @tailwindcss/forms @tailwindcss/typography postcss postcss-nesting autoprefixer --save-dev"); @@ -66,9 +66,9 @@ public function handle(): int 'viewPathPrefix' => $viewPathPrefix, ]); - $this->components->info('Filament theme [resources/css/filament/theme.css] and [resources/css/filament/tailwind.config.js] created successfully in '.$module->getStudlyName().' module.'); + $this->components->info('Filament theme [resources/css/filament/theme.css] and [resources/css/filament/tailwind.config.js] created successfully in ' . $module->getStudlyName() . ' module.'); - $buildDirectory = 'build-'.$module->getLowerName(); + $buildDirectory = 'build-' . $module->getLowerName(); $moduleStudlyName = $module->getStudlyName(); if (empty(glob($module->getExtraPath('vite.config.*s')))) { @@ -76,7 +76,7 @@ public function handle(): int $this->components->bulletList([ "It looks like you don't have Vite installed in your module. Please use your asset bundling system of choice to compile `resources/css/filament/theme.css` into `public/$buildDirectory/css/filament/theme.css`.", "If you're not currently using a bundler, we recommend using Vite. Alternatively, you can use the Tailwind CLI with the following command inside the $moduleStudlyName module:", - 'npx tailwindcss --input ./resources/css/filament/theme.css --output ./public/'.$buildDirectory.'/css/filament/theme.css --config ./resources/css/filament/tailwind.config.js --minify', + 'npx tailwindcss --input ./resources/css/filament/theme.css --output ./public/' . $buildDirectory . '/css/filament/theme.css --config ./resources/css/filament/tailwind.config.js --minify', "Make sure to register the theme in the {$moduleStudlyName} module plugin under the afterRegister() function using `->theme(asset('css/filament/theme.css'))`", ]); @@ -103,7 +103,7 @@ public function handle(): int protected function getDefaultStubPath(): string { - return __DIR__.'/stubs'; + return __DIR__ . '/stubs'; } private function getModule(): Module diff --git a/src/Concerns/ModuleFilamentPlugin.php b/src/Concerns/ModuleFilamentPlugin.php index a18868fb..abb5214e 100644 --- a/src/Concerns/ModuleFilamentPlugin.php +++ b/src/Concerns/ModuleFilamentPlugin.php @@ -19,15 +19,15 @@ public function register(Panel $panel): void $module = $this->getModule(); $useClusters = config('filament-modules.clusters.enabled', false); $panel->discoverPages( - in: $module->appPath('Filament'.DIRECTORY_SEPARATOR.'Pages'), + in: $module->appPath('Filament' . DIRECTORY_SEPARATOR . 'Pages'), for: $module->appNamespace('\\Filament\\Pages') ); $panel->discoverResources( - in: $module->appPath('Filament'.DIRECTORY_SEPARATOR.'Resources'), + in: $module->appPath('Filament' . DIRECTORY_SEPARATOR . 'Resources'), for: $module->appNamespace('\\Filament\\Resources') ); $panel->discoverWidgets( - in: $module->appPath('Filament'.DIRECTORY_SEPARATOR.'Widgets'), + in: $module->appPath('Filament' . DIRECTORY_SEPARATOR . 'Widgets'), for: $module->appNamespace('\\Filament\\Widgets') ); @@ -37,7 +37,7 @@ public function register(Panel $panel): void ); if ($useClusters) { - $path = $module->appPath('Filament'.DIRECTORY_SEPARATOR.'Clusters'); + $path = $module->appPath('Filament' . DIRECTORY_SEPARATOR . 'Clusters'); $namespace = $module->appNamespace('\\Filament\\Clusters'); $panel->discoverClusters( in: $path, From e860e1c787df2dea32ba3b68162cb6df33c0726a Mon Sep 17 00:00:00 2001 From: coolsam726 Date: Wed, 24 Apr 2024 15:52:57 +0000 Subject: [PATCH 16/17] Fix styling --- src/Commands/ModuleMakeFilamentPageCommand.php | 2 +- src/Commands/ModuleMakeFilamentThemeCommand.php | 10 +++++----- src/Concerns/ModuleFilamentPlugin.php | 8 ++++---- tests/Unit/GeneratesModularFilesConcernTest.php | 2 +- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/Commands/ModuleMakeFilamentPageCommand.php b/src/Commands/ModuleMakeFilamentPageCommand.php index 9c3d5447..d4724e77 100644 --- a/src/Commands/ModuleMakeFilamentPageCommand.php +++ b/src/Commands/ModuleMakeFilamentPageCommand.php @@ -239,7 +239,7 @@ public function handle(): int (string) str($view) ->replace($module->getLowerName() . '::', '') ->replace('.', DIRECTORY_SEPARATOR) - ->prepend('views'.DIRECTORY_SEPARATOR) + ->prepend('views' . DIRECTORY_SEPARATOR) ->append('.blade.php'), ); diff --git a/src/Commands/ModuleMakeFilamentThemeCommand.php b/src/Commands/ModuleMakeFilamentThemeCommand.php index b47c908b..c7f03e6b 100644 --- a/src/Commands/ModuleMakeFilamentThemeCommand.php +++ b/src/Commands/ModuleMakeFilamentThemeCommand.php @@ -40,7 +40,7 @@ public function handle(): int 'yarn' => 'yarn add', default => "{$pm} install", }; - $cdCommand = 'cd '.$module->getPath(); + $cdCommand = 'cd ' . $module->getPath(); exec("$cdCommand && {$installCommand} tailwindcss @tailwindcss/forms @tailwindcss/typography postcss postcss-nesting autoprefixer --save-dev"); @@ -66,9 +66,9 @@ public function handle(): int 'viewPathPrefix' => $viewPathPrefix, ]); - $this->components->info('Filament theme [resources/css/filament/theme.css] and [resources/css/filament/tailwind.config.js] created successfully in '.$module->getStudlyName().' module.'); + $this->components->info('Filament theme [resources/css/filament/theme.css] and [resources/css/filament/tailwind.config.js] created successfully in ' . $module->getStudlyName() . ' module.'); - $buildDirectory = 'build-'.$module->getLowerName(); + $buildDirectory = 'build-' . $module->getLowerName(); $moduleStudlyName = $module->getStudlyName(); if (empty(glob($module->getExtraPath('vite.config.*s')))) { @@ -76,7 +76,7 @@ public function handle(): int $this->components->bulletList([ "It looks like you don't have Vite installed in your module. Please use your asset bundling system of choice to compile `resources/css/filament/theme.css` into `public/$buildDirectory/css/filament/theme.css`.", "If you're not currently using a bundler, we recommend using Vite. Alternatively, you can use the Tailwind CLI with the following command inside the $moduleStudlyName module:", - 'npx tailwindcss --input ./resources/css/filament/theme.css --output ./public/'.$buildDirectory.'/css/filament/theme.css --config ./resources/css/filament/tailwind.config.js --minify', + 'npx tailwindcss --input ./resources/css/filament/theme.css --output ./public/' . $buildDirectory . '/css/filament/theme.css --config ./resources/css/filament/tailwind.config.js --minify', "Make sure to register the theme in the {$moduleStudlyName} module plugin under the afterRegister() function using `->theme(asset('css/filament/theme.css'))`", ]); @@ -103,7 +103,7 @@ public function handle(): int protected function getDefaultStubPath(): string { - return __DIR__.'/stubs'; + return __DIR__ . '/stubs'; } private function getModule(): Module diff --git a/src/Concerns/ModuleFilamentPlugin.php b/src/Concerns/ModuleFilamentPlugin.php index a18868fb..abb5214e 100644 --- a/src/Concerns/ModuleFilamentPlugin.php +++ b/src/Concerns/ModuleFilamentPlugin.php @@ -19,15 +19,15 @@ public function register(Panel $panel): void $module = $this->getModule(); $useClusters = config('filament-modules.clusters.enabled', false); $panel->discoverPages( - in: $module->appPath('Filament'.DIRECTORY_SEPARATOR.'Pages'), + in: $module->appPath('Filament' . DIRECTORY_SEPARATOR . 'Pages'), for: $module->appNamespace('\\Filament\\Pages') ); $panel->discoverResources( - in: $module->appPath('Filament'.DIRECTORY_SEPARATOR.'Resources'), + in: $module->appPath('Filament' . DIRECTORY_SEPARATOR . 'Resources'), for: $module->appNamespace('\\Filament\\Resources') ); $panel->discoverWidgets( - in: $module->appPath('Filament'.DIRECTORY_SEPARATOR.'Widgets'), + in: $module->appPath('Filament' . DIRECTORY_SEPARATOR . 'Widgets'), for: $module->appNamespace('\\Filament\\Widgets') ); @@ -37,7 +37,7 @@ public function register(Panel $panel): void ); if ($useClusters) { - $path = $module->appPath('Filament'.DIRECTORY_SEPARATOR.'Clusters'); + $path = $module->appPath('Filament' . DIRECTORY_SEPARATOR . 'Clusters'); $namespace = $module->appNamespace('\\Filament\\Clusters'); $panel->discoverClusters( in: $path, diff --git a/tests/Unit/GeneratesModularFilesConcernTest.php b/tests/Unit/GeneratesModularFilesConcernTest.php index 6dbb568f..470576ca 100644 --- a/tests/Unit/GeneratesModularFilesConcernTest.php +++ b/tests/Unit/GeneratesModularFilesConcernTest.php @@ -21,5 +21,5 @@ public function getStub() test('can generate the correct stubs path', function () { // include the GeneratesModularFiles trait expect($this->trait->getStub()) - ->toEqual(realpath(__DIR__.'/../../src/Commands/stubs/filament-plugin.stub')); + ->toEqual(realpath(__DIR__ . '/../../src/Commands/stubs/filament-plugin.stub')); }); From a3bc155441c8c5e6be948c4a38233ed8fc021303 Mon Sep 17 00:00:00 2001 From: coolsam726 Date: Wed, 24 Apr 2024 15:58:03 +0000 Subject: [PATCH 17/17] Update CHANGELOG --- CHANGELOG.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 98932cf1..bbd8c5be 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,16 @@ All notable changes to `modules` will be documented in this file. +## v4.0.5 - 2024-04-24 + +### What's Changed + +* Failing Tests: Changed the test to use DIRECTORY_SEPARATOR by @coolsam726 in https://github.com/savannabits/filament-modules/pull/99 +* Code Cleanup: PHPStan was failing by @coolsam726 in https://github.com/savannabits/filament-modules/pull/100 +* Bug Fix: Duplicate src in file path by @coolsam726 in https://github.com/savannabits/filament-modules/pull/102 + +**Full Changelog**: https://github.com/savannabits/filament-modules/compare/v4.0.4...v4.0.5 + ## v4.0.4 - 2024-04-20 ### What's Changed