From 58867dd0bc51adb72ae78f2900f4814964eba63a Mon Sep 17 00:00:00 2001 From: Mior Muhammad Zaki Date: Mon, 18 Nov 2024 22:20:22 +0800 Subject: [PATCH] [5.x] Remove `php artisan pail` from `composer run dev` on Windows (#366) * [5.x] Remove `php artisan pail` from `composer run dev` on Windows fixes #365 Signed-off-by: Mior Muhammad Zaki * Apply fixes from StyleCI * wip Signed-off-by: Mior Muhammad Zaki * wip Signed-off-by: Mior Muhammad Zaki * Update NewCommand.php --------- Signed-off-by: Mior Muhammad Zaki Co-authored-by: StyleCI Bot Co-authored-by: Taylor Otwell --- src/NewCommand.php | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/NewCommand.php b/src/NewCommand.php index df7ebbe..30bd1ab 100644 --- a/src/NewCommand.php +++ b/src/NewCommand.php @@ -241,6 +241,8 @@ protected function execute(InputInterface $input, OutputInterface $output): int $output->writeln(''); } + $this->configureComposerDevScript($directory); + $output->writeln(" INFO Application ready in [{$name}]. You can start your local development using:".PHP_EOL); $output->writeln('cd '.$name.''); $output->writeln('npm install && npm run build'); @@ -758,6 +760,23 @@ protected function pushToGitHub(string $name, string $directory, InputInterface $this->runCommands($commands, $input, $output, workingPath: $directory, env: ['GIT_TERMINAL_PROMPT' => 0]); } + /** + * Configure the Composer "dev" script. + * + * @param string $directory + * @return void + */ + protected function configureComposerDevScript(string $directory): void + { + $this->composer->modify(function (array $content) { + if (windows_os()) { + $content['scripts']['dev'] = "npx concurrently -c \"#93c5fd,#c4b5fd,#fdba74\" \"php artisan serve\" \"php artisan queue:listen --tries=1\" \"npm run dev\" --names='server,queue,vite'"; + } + + return $content; + }); + } + /** * Verify that the application does not already exist. *