From 4d084c3678ddcb584ada38e7dcd739d023db455e Mon Sep 17 00:00:00 2001 From: Mark Myers Date: Thu, 5 Mar 2020 16:45:29 -0500 Subject: [PATCH 1/2] Correctly call the tailwindcss preset if the auth flag is not passed Due to the removal of `tailwindcss-auth` macro the `tailwindcss` macro will always run `TailwindCssPreset::installAuth()`. This is in large part because how macro's work and the `UiCommand::macro('tailwindcss')` getting overwritten by `AuthCommand::macro('tailwindcss')`. This commit assumes that just having one macro of `tailwindcss` is the acceptable use moving forward. With that said, this commit check the command option auth flag and if it's true will correctly install all the auth presets. This commit also removes the call to the `install()` method on the TailwindCssPreset::installAuth method as this should always be called on the macro. --- src/TailwindCssPreset.php | 1 - src/TailwindCssPresetServiceProvider.php | 11 ++++------- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/src/TailwindCssPreset.php b/src/TailwindCssPreset.php index b169316d..1b2c1d38 100644 --- a/src/TailwindCssPreset.php +++ b/src/TailwindCssPreset.php @@ -23,7 +23,6 @@ public static function install() public static function installAuth() { - static::install(); static::scaffoldController(); static::scaffoldAuth(); } diff --git a/src/TailwindCssPresetServiceProvider.php b/src/TailwindCssPresetServiceProvider.php index d6cf6f72..ffd3fb7e 100644 --- a/src/TailwindCssPresetServiceProvider.php +++ b/src/TailwindCssPresetServiceProvider.php @@ -14,14 +14,11 @@ public function boot() UiCommand::macro('tailwindcss', function ($command) { TailwindCssPreset::install(); - $command->info('Tailwind CSS scaffolding installed successfully.'); - $command->comment('Please run "npm install && npm run dev" to compile your fresh scaffolding.'); - }); + if ( $command->option('auth') ) { + TailwindCssPreset::installAuth(); + } - AuthCommand::macro('tailwindcss', function ($command) { - TailwindCssPreset::installAuth(); - - $command->info('Tailwind CSS scaffolding with auth views installed successfully.'); + $command->info('Tailwind CSS scaffolding installed successfully.'); $command->comment('Please run "npm install && npm run dev" to compile your fresh scaffolding.'); }); From 5bdbb58e7449e699d9143c6af343bee0b05a5f19 Mon Sep 17 00:00:00 2001 From: Michael Dyrynda Date: Sat, 7 Mar 2020 12:42:13 +1030 Subject: [PATCH 2/2] Display info when both base scaffolding, and auth scaffolding installed Closes #89 Closes #90 --- README.md | 2 +- src/TailwindCssPresetServiceProvider.php | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index c17030b9..5dc6a442 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,7 @@ A Laravel front-end scaffolding preset for [Tailwind CSS](https://tailwindcss.co ### b. For Presets with Authentication -1. Use `php artisan ui tailwindcss --auth` for the basic preset, auth route entry and Tailwind CSS auth views in one go. (NOTE: If you run this command several times, be sure to clean up the duplicate Auth entries in `routes/web.php`) +1. Use `php artisan ui tailwindcss --auth` for the basic preset, auth route entry, and Tailwind CSS auth views in one go. (NOTE: If you run this command several times, be sure to clean up the duplicate Auth entries in `routes/web.php`) 4. `npm install && npm run dev` 5. Configure your favorite database (mysql, sqlite etc.) 6. `php artisan migrate` to create basic user tables. diff --git a/src/TailwindCssPresetServiceProvider.php b/src/TailwindCssPresetServiceProvider.php index ffd3fb7e..8e648e02 100644 --- a/src/TailwindCssPresetServiceProvider.php +++ b/src/TailwindCssPresetServiceProvider.php @@ -14,11 +14,14 @@ public function boot() UiCommand::macro('tailwindcss', function ($command) { TailwindCssPreset::install(); - if ( $command->option('auth') ) { + $command->info('Tailwind CSS scaffolding installed successfully.'); + + if ($command->option('auth')) { TailwindCssPreset::installAuth(); + + $command->info('Tailwind CSS auth scaffolding installed successfully.'); } - $command->info('Tailwind CSS scaffolding installed successfully.'); $command->comment('Please run "npm install && npm run dev" to compile your fresh scaffolding.'); });