From 865ac1fa0f2b1f51696c499727f82ef1909bf54a Mon Sep 17 00:00:00 2001 From: Mior Muhammad Zaki Date: Fri, 18 Aug 2023 21:33:54 +0800 Subject: [PATCH] Reorganise workbench install scripts (#11) * Reorganise workbench install scripts Signed-off-by: Mior Muhammad Zaki * wip Signed-off-by: Mior Muhammad Zaki --------- Signed-off-by: Mior Muhammad Zaki --- composer.json | 11 +++-------- src/Console/InstallCommand.php | 21 ++++++++------------- 2 files changed, 11 insertions(+), 21 deletions(-) diff --git a/composer.json b/composer.json index 31a9079..3bce92a 100644 --- a/composer.json +++ b/composer.json @@ -44,8 +44,8 @@ }, "scripts": { "post-autoload-dump": [ - "@composer run clear", - "@composer run prepare" + "@clear", + "@prepare" ], "ci": [ "@composer audit", @@ -55,12 +55,7 @@ "clear": "@php vendor/bin/testbench package:purge-skeleton --ansi", "prepare": "@php vendor/bin/testbench package:discover --ansi", "build": "@php vendor/bin/testbench workbench:build", - "serve": [ - "@composer run clear", - "@composer run prepare", - "@composer run build", - "@php vendor/bin/testbench serve" - ], + "serve": "@php vendor/bin/testbench serve", "lint": [ "@composer run prepare", "@php vendor/bin/pint", diff --git a/src/Console/InstallCommand.php b/src/Console/InstallCommand.php index 833d6bb..99cf375 100644 --- a/src/Console/InstallCommand.php +++ b/src/Console/InstallCommand.php @@ -89,19 +89,9 @@ protected function appendScriptsToComposer(array $content, Filesystem $filesyste $content['scripts'] = []; } - $content['scripts']['clear'] = '@php vendor/bin/testbench package:purge-skeleton --ansi'; - $content['scripts']['prepare'] = '@php vendor/bin/testbench package:discover --ansi'; - $content['scripts']['build'] = '@php vendor/bin/testbench workbench:build'; - $content['scripts']['serve'] = [ - '@composer run clear', - '@composer run prepare', - '@composer run build', - '@php vendor/bin/testbench serve', - ]; - $postAutoloadDumpScripts = [ - '@composer run clear', - '@composer run prepare', + '@clear', + '@prepare', ]; if (! \array_key_exists('post-autoload-dump', $content['scripts'])) { @@ -113,6 +103,11 @@ protected function appendScriptsToComposer(array $content, Filesystem $filesyste ]); } + $content['scripts']['clear'] = '@php vendor/bin/testbench package:purge-skeleton --ansi'; + $content['scripts']['prepare'] = '@php vendor/bin/testbench package:discover --ansi'; + $content['scripts']['build'] = '@php vendor/bin/testbench workbench:build'; + $content['scripts']['serve'] = '@php vendor/bin/testbench serve'; + if (! \array_key_exists('lint', $content['scripts'])) { $lintScripts = []; @@ -128,7 +123,7 @@ protected function appendScriptsToComposer(array $content, Filesystem $filesyste if (\count($lintScripts) > 0) { $content['scripts']['lint'] = [ - '@composer run prepare', + '@prepare', ...$lintScripts, ]; }