From 3dc542859c84ab57f39a3bdf41160b1dbe2e2089 Mon Sep 17 00:00:00 2001 From: Adrien Leloup Date: Thu, 23 Jun 2022 09:31:38 +0200 Subject: [PATCH] Added Laravel Pint, removed old fix-style command --- composer.json | 9 ++++--- src/Codestyle.php | 5 ++-- src/ComposerEnv.php | 6 +++++ src/Console/FixStyleCommand.php | 44 -------------------------------- src/WhitecubeServiceProvider.php | 3 --- src/stubs/pint.json | 3 +++ 6 files changed, 16 insertions(+), 54 deletions(-) delete mode 100644 src/Console/FixStyleCommand.php create mode 100644 src/stubs/pint.json diff --git a/composer.json b/composer.json index befa736..6155963 100644 --- a/composer.json +++ b/composer.json @@ -16,12 +16,13 @@ } ], "require": { - "php": "^7.3|^8.0", + "php": "^8.0", + "barryvdh/laravel-debugbar": "^3.6", + "laravel/pint": "^0.1.0", "laravel/ui": "^3.0", + "pestphp/pest-plugin-laravel": "^1.2.0", "whitecube/bem-components": "^1.1", - "whitecube/laravel-sluggable": "^1.6", - "barryvdh/laravel-debugbar": "^3.6", - "pestphp/pest-plugin-laravel": "^1.2.0" + "whitecube/laravel-sluggable": "^1.6" }, "require-dev": { "jubeki/laravel-code-style": "^1.0", diff --git a/src/Codestyle.php b/src/Codestyle.php index 191966d..e027ddd 100644 --- a/src/Codestyle.php +++ b/src/Codestyle.php @@ -10,9 +10,8 @@ class Codestyle public static function install(UiCommand $command) { $command->info('Installing code style fixer...'); - $command->call('vendor:publish', [ - '--provider' => 'MattAllan\LaravelCodeStyle\ServiceProvider' - ]); + + copy(__DIR__.'/stubs/pint.json', base_path('pint.json')); } } diff --git a/src/ComposerEnv.php b/src/ComposerEnv.php index 0915e64..822834f 100644 --- a/src/ComposerEnv.php +++ b/src/ComposerEnv.php @@ -35,5 +35,11 @@ public static function addComposerScripts() 'scripts.pre-update-cmd', 'App\\Console\\Commands\\ComposerEnv::loadLocalRepositories' ]); + + $composer->run([ + 'config', + 'scripts.fix-style', + './vendor/bin/pint --preset laravel' + ]); } } diff --git a/src/Console/FixStyleCommand.php b/src/Console/FixStyleCommand.php deleted file mode 100644 index 17b8f93..0000000 --- a/src/Console/FixStyleCommand.php +++ /dev/null @@ -1,44 +0,0 @@ -commands([ - FixStyleCommand::class - ]); } } diff --git a/src/stubs/pint.json b/src/stubs/pint.json new file mode 100644 index 0000000..93061b6 --- /dev/null +++ b/src/stubs/pint.json @@ -0,0 +1,3 @@ +{ + "preset": "laravel" +}