From 5e66bdc5bf870144562b080cd3e7bd473d95e6b3 Mon Sep 17 00:00:00 2001 From: Rogerio Pereira Date: Wed, 16 Apr 2025 20:24:37 -0400 Subject: [PATCH 01/16] feat: Update laravel/installer on resources/scripts/php.sh --- resources/scripts/php.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/scripts/php.sh b/resources/scripts/php.sh index 7f849b9..17c8cce 100755 --- a/resources/scripts/php.sh +++ b/resources/scripts/php.sh @@ -12,7 +12,7 @@ docker run --rm \ -v "$(pwd)":/opt \ -w /opt \ laravelsail/php{{ php }}-composer:latest \ - bash -c "laravel new {{ name }} --no-interaction && cd {{ name }} && php ./artisan sail:install --with={{ with }} {{ devcontainer }}" + bash -c "composer global update laravel/installer && laravel new {{ name }} --no-interaction && cd {{ name }} && php ./artisan sail:install --with={{ with }} {{ devcontainer }}" cd {{ name }} From 449d84afc0bd3109448e2f4492beadc831cb35a6 Mon Sep 17 00:00:00 2001 From: Rogerio Pereira Date: Wed, 16 Apr 2025 20:24:49 -0400 Subject: [PATCH 02/16] test: Update laravel/installer on script.sh --- tests/Feature/Laravel12Test.php | 18 ++++++++++++++++++ tests/Feature/SailServerTest.php | 6 +++--- 2 files changed, 21 insertions(+), 3 deletions(-) create mode 100644 tests/Feature/Laravel12Test.php diff --git a/tests/Feature/Laravel12Test.php b/tests/Feature/Laravel12Test.php new file mode 100644 index 0000000..753cbe4 --- /dev/null +++ b/tests/Feature/Laravel12Test.php @@ -0,0 +1,18 @@ +get('/example-app'); + + $response->assertStatus(200); + $response->assertSee('bash -c "composer global update laravel/installer && laravel new example-app --no-interaction && cd example-app && php ./artisan sail:install --with=mysql,redis,meilisearch,mailpit,selenium "', false); + } +} diff --git a/tests/Feature/SailServerTest.php b/tests/Feature/SailServerTest.php index 34fd655..6dc1997 100644 --- a/tests/Feature/SailServerTest.php +++ b/tests/Feature/SailServerTest.php @@ -17,7 +17,7 @@ public function test_it_can_return_the_sail_install_script() $response->assertStatus(200); $response->assertSee("laravelsail/php84-composer:latest"); - $response->assertSee('bash -c "laravel new example-app --no-interaction && cd example-app && php ./artisan sail:install --with=mysql,redis,meilisearch,mailpit,selenium "', false); + $response->assertSee('bash -c "composer global update laravel/installer && laravel new example-app --no-interaction && cd example-app && php ./artisan sail:install --with=mysql,redis,meilisearch,mailpit,selenium "', false); } public function test_different_php_versions_can_be_picked() @@ -49,7 +49,7 @@ public function test_it_removes_duplicated_valid_services() $response = $this->get('/example-app?with=redis,redis'); $response->assertStatus(200); - $response->assertSee('bash -c "laravel new example-app --no-interaction && cd example-app && php ./artisan sail:install --with=redis "', false); + $response->assertSee('bash -c "composer global update laravel/installer && laravel new example-app --no-interaction && cd example-app && php ./artisan sail:install --with=redis "', false); } public function test_it_adds_the_devcontainer_upon_request() @@ -57,7 +57,7 @@ public function test_it_adds_the_devcontainer_upon_request() $response = $this->get('/example-app?with=pgsql&devcontainer'); $response->assertStatus(200); - $response->assertSee('bash -c "laravel new example-app --no-interaction && cd example-app && php ./artisan sail:install --with=pgsql --devcontainer"', false); + $response->assertSee('bash -c "composer global update laravel/installer && laravel new example-app --no-interaction && cd example-app && php ./artisan sail:install --with=pgsql --devcontainer"', false); } public function test_it_does_not_accepts_domains_with_a_dot() From a0c25ccefaf37546f5f15030be35c7d167fa4f01 Mon Sep 17 00:00:00 2001 From: Rogerio Pereira Date: Wed, 16 Apr 2025 22:04:18 -0400 Subject: [PATCH 03/16] feat: Allow choose frontend --- resources/scripts/php.sh | 2 +- routes/web.php | 23 +++++++++++++++++++++-- 2 files changed, 22 insertions(+), 3 deletions(-) diff --git a/resources/scripts/php.sh b/resources/scripts/php.sh index 17c8cce..2d904a4 100755 --- a/resources/scripts/php.sh +++ b/resources/scripts/php.sh @@ -12,7 +12,7 @@ docker run --rm \ -v "$(pwd)":/opt \ -w /opt \ laravelsail/php{{ php }}-composer:latest \ - bash -c "composer global update laravel/installer && laravel new {{ name }} --no-interaction && cd {{ name }} && php ./artisan sail:install --with={{ with }} {{ devcontainer }}" + bash -c "composer global update laravel/installer && laravel new {{ name }} {{ frontend }} --no-interaction && cd {{ name }} && php ./artisan sail:install --with={{ with }} {{ devcontainer }}" cd {{ name }} diff --git a/routes/web.php b/routes/web.php index b8a27f6..d83b441 100644 --- a/routes/web.php +++ b/routes/web.php @@ -25,16 +25,26 @@ 'soketi', ]; + $availableFrontends = [ + 'react', + 'vue', + 'livewire', + 'livewire-class-components', + ]; + $php = $request->query('php', '84'); $with = array_unique(explode(',', $request->query('with', 'mysql,redis,meilisearch,mailpit,selenium'))); + $frontend = $request->query('frontend', 'livewire'); + try { Validator::validate( [ 'name' => $name, 'php' => $php, 'with' => $with, + 'frontend' => $frontend, ], [ 'name' => 'string|alpha_dash', @@ -45,6 +55,8 @@ 'string', count($with) === 1 && in_array('none', $with) ? Rule::in(['none']) : Rule::in($availableServices) ], + + 'frontend' => ['string', Rule::in($availableFrontends)], ] ); } catch (ValidationException $e) { @@ -61,6 +73,10 @@ if (array_key_exists('with', $errors)) { return response('Invalid service name. Please provide one or more of the supported services ('.implode(', ', $availableServices).') or "none".', 400); } + + if (array_key_exists('frontend', $errors)) { + return response('Invalid frontend. Please provide one supported frontend ('.implode(', ', $availableFrontends).') or leave it empty (it will use livewire).', 400); + } } $services = implode(' ', $with); @@ -69,9 +85,12 @@ $devcontainer = $request->has('devcontainer') ? '--devcontainer' : ''; + //Prepend -- to frontend, auth and test + $frontend = ($frontend) ? "--{$frontend}" : null; + $script = str_replace( - ['{{ php }}', '{{ name }}', '{{ with }}', '{{ devcontainer }}', '{{ services }}'], - [$php, $name, $with, $devcontainer, $services], + ['{{ php }}', '{{ name }}', '{{ frontend }}', '{{ with }}', '{{ devcontainer }}', '{{ services }}'], + [$php, $name, "$frontend", $with, $devcontainer, $services], file_get_contents(resource_path('scripts/php.sh')) ); From 5f0047a1e522967dc22edb74cd588c8f86cd94b5 Mon Sep 17 00:00:00 2001 From: Rogerio Pereira Date: Wed, 16 Apr 2025 22:04:44 -0400 Subject: [PATCH 04/16] test: Allow choose frontend --- tests/Feature/Laravel12FrontendTest.php | 58 +++++++++++++++++++++++++ tests/Feature/Laravel12Test.php | 2 +- 2 files changed, 59 insertions(+), 1 deletion(-) create mode 100644 tests/Feature/Laravel12FrontendTest.php diff --git a/tests/Feature/Laravel12FrontendTest.php b/tests/Feature/Laravel12FrontendTest.php new file mode 100644 index 0000000..2375b4e --- /dev/null +++ b/tests/Feature/Laravel12FrontendTest.php @@ -0,0 +1,58 @@ +get('/example-app'); + + $response->assertStatus(200); + $response->assertSee('laravel new example-app --livewire --pest --no-interaction', false); + } + + public function test_it_accepts_frontend_livewire() + { + $response = $this->get('/example-app?frontend=livewire'); + + $response->assertStatus(200); + $response->assertSee('laravel new example-app --livewire --pest --no-interaction', false); + } + + public function test_it_accepts_frontend_react() + { + $response = $this->get('/example-app?frontend=react'); + + $response->assertStatus(200); + $response->assertSee('laravel new example-app --react --pest --no-interaction', false); + } + + public function test_it_accepts_frontend_vue() + { + $response = $this->get('/example-app?frontend=vue'); + + $response->assertStatus(200); + $response->assertSee('laravel new example-app --vue --pest --no-interaction', false); + } + + public function test_it_accepts_frontend_livewire_class_components() + { + $response = $this->get('/example-app?frontend=livewire-class-components'); + + $response->assertStatus(200); + $response->assertSee('laravel new example-app --livewire-class-components --pest --no-interaction', false); + } + + public function test_it_does_not_accept_invalid_frontend() + { + $response = $this->get('/example-app?frontend=invalid'); + + $response->assertStatus(400); + $response->assertSee('Invalid frontend. Please provide one supported frontend (react, vue, livewire, livewire-class-components) or leave it empty (it will use livewire).'); + } +} diff --git a/tests/Feature/Laravel12Test.php b/tests/Feature/Laravel12Test.php index 753cbe4..677d1d0 100644 --- a/tests/Feature/Laravel12Test.php +++ b/tests/Feature/Laravel12Test.php @@ -13,6 +13,6 @@ public function test_it_should_update_laravel_installer() $response = $this->get('/example-app'); $response->assertStatus(200); - $response->assertSee('bash -c "composer global update laravel/installer && laravel new example-app --no-interaction && cd example-app && php ./artisan sail:install --with=mysql,redis,meilisearch,mailpit,selenium "', false); + $response->assertSee('bash -c "composer global update laravel/installer && laravel new example-app --livewire --no-interaction && cd example-app && php ./artisan sail:install --with=mysql,redis,meilisearch,mailpit,selenium "', false); } } From 6a88c60b337a9c40730744bb0d00dad9ac9299a3 Mon Sep 17 00:00:00 2001 From: Rogerio Pereira Date: Wed, 16 Apr 2025 22:13:17 -0400 Subject: [PATCH 05/16] feat: Allow choose Authentication Provider --- resources/scripts/php.sh | 2 +- routes/web.php | 22 ++++++++++++++++++++-- 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/resources/scripts/php.sh b/resources/scripts/php.sh index 2d904a4..e16296f 100755 --- a/resources/scripts/php.sh +++ b/resources/scripts/php.sh @@ -12,7 +12,7 @@ docker run --rm \ -v "$(pwd)":/opt \ -w /opt \ laravelsail/php{{ php }}-composer:latest \ - bash -c "composer global update laravel/installer && laravel new {{ name }} {{ frontend }} --no-interaction && cd {{ name }} && php ./artisan sail:install --with={{ with }} {{ devcontainer }}" + bash -c "composer global update laravel/installer && laravel new {{ name }} {{ frontend }} {{ authProvider }} --no-interaction && cd {{ name }} && php ./artisan sail:install --with={{ with }} {{ devcontainer }}" cd {{ name }} diff --git a/routes/web.php b/routes/web.php index d83b441..f1dd1d6 100644 --- a/routes/web.php +++ b/routes/web.php @@ -32,11 +32,16 @@ 'livewire-class-components', ]; + $availableAuthentication = [ + 'workos', + ]; + $php = $request->query('php', '84'); $with = array_unique(explode(',', $request->query('with', 'mysql,redis,meilisearch,mailpit,selenium'))); $frontend = $request->query('frontend', 'livewire'); + $auth = $request->query('auth', null); try { Validator::validate( @@ -45,6 +50,7 @@ 'php' => $php, 'with' => $with, 'frontend' => $frontend, + 'auth' => $auth, ], [ 'name' => 'string|alpha_dash', @@ -57,6 +63,7 @@ ], 'frontend' => ['string', Rule::in($availableFrontends)], + 'auth' => ['nullable', 'string', Rule::in($availableAuthentication)], ] ); } catch (ValidationException $e) { @@ -77,6 +84,10 @@ if (array_key_exists('frontend', $errors)) { return response('Invalid frontend. Please provide one supported frontend ('.implode(', ', $availableFrontends).') or leave it empty (it will use livewire).', 400); } + + if (array_key_exists('auth', $errors)) { + return response('Invalid Authentication Provider. Please provide one supported Authentication Provider ('.implode(', ', $availableAuthentication).') or leave it empty (it will use laravel).', 400); + } } $services = implode(' ', $with); @@ -88,9 +99,16 @@ //Prepend -- to frontend, auth and test $frontend = ($frontend) ? "--{$frontend}" : null; + /* + * Adding a trailing space because if not on all tests i have to fix to + * laravel new example-app --livewire --no-interaction + * It will have two spaces after --livewire + */ + $auth = ($auth) ? "--{$auth} " : null; + $script = str_replace( - ['{{ php }}', '{{ name }}', '{{ frontend }}', '{{ with }}', '{{ devcontainer }}', '{{ services }}'], - [$php, $name, "$frontend", $with, $devcontainer, $services], + ['{{ php }}', '{{ name }}', '{{ frontend }}', '{{ authProvider }} ', '{{ with }}', '{{ devcontainer }}', '{{ services }}'], + [$php, $name, "$frontend", "$auth", $with, $devcontainer, $services], file_get_contents(resource_path('scripts/php.sh')) ); From b7292b8aa084f8421b3c7a3e280e8fc1029326c3 Mon Sep 17 00:00:00 2001 From: Rogerio Pereira Date: Wed, 16 Apr 2025 22:13:36 -0400 Subject: [PATCH 06/16] test: Allow choose Authentication Provider --- tests/Feature/Laravel12AuthTest.php | 34 +++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 tests/Feature/Laravel12AuthTest.php diff --git a/tests/Feature/Laravel12AuthTest.php b/tests/Feature/Laravel12AuthTest.php new file mode 100644 index 0000000..0bb9a6d --- /dev/null +++ b/tests/Feature/Laravel12AuthTest.php @@ -0,0 +1,34 @@ +get('/example-app'); + + $response->assertStatus(200); + $response->assertSee('laravel new example-app --livewire --no-interaction', false); + } + + public function test_it_accepts_auth_workos() + { + $response = $this->get('/example-app?auth=workos'); + + $response->assertStatus(200); + $response->assertSee('laravel new example-app --livewire --workos --no-interaction', false); + } + + public function test_it_does_not_accept_invalid_auth() + { + $response = $this->get('/example-app?auth=invalid'); + + $response->assertStatus(400); + $response->assertSee('Invalid Authentication Provider. Please provide one supported Authentication Provider (workos) or leave it empty (it will use laravel).'); + } +} From 20d071f0a91c51394be1c030d76db4094f0a9ce1 Mon Sep 17 00:00:00 2001 From: Rogerio Pereira Date: Wed, 16 Apr 2025 22:16:29 -0400 Subject: [PATCH 07/16] feat: Allow choose Testing Framework --- resources/scripts/php.sh | 2 +- routes/web.php | 17 +++++++++++++++-- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/resources/scripts/php.sh b/resources/scripts/php.sh index e16296f..73772e9 100755 --- a/resources/scripts/php.sh +++ b/resources/scripts/php.sh @@ -12,7 +12,7 @@ docker run --rm \ -v "$(pwd)":/opt \ -w /opt \ laravelsail/php{{ php }}-composer:latest \ - bash -c "composer global update laravel/installer && laravel new {{ name }} {{ frontend }} {{ authProvider }} --no-interaction && cd {{ name }} && php ./artisan sail:install --with={{ with }} {{ devcontainer }}" + bash -c "composer global update laravel/installer && laravel new {{ name }} {{ frontend }} {{ authProvider }} {{ testFramework }} --no-interaction && cd {{ name }} && php ./artisan sail:install --with={{ with }} {{ devcontainer }}" cd {{ name }} diff --git a/routes/web.php b/routes/web.php index f1dd1d6..1652fe3 100644 --- a/routes/web.php +++ b/routes/web.php @@ -36,12 +36,18 @@ 'workos', ]; + $availableTestFrameworks = [ + 'phpunit', + 'pest', + ]; + $php = $request->query('php', '84'); $with = array_unique(explode(',', $request->query('with', 'mysql,redis,meilisearch,mailpit,selenium'))); $frontend = $request->query('frontend', 'livewire'); $auth = $request->query('auth', null); + $tests = $request->query('tests', 'pest'); try { Validator::validate( @@ -51,6 +57,7 @@ 'with' => $with, 'frontend' => $frontend, 'auth' => $auth, + 'tests' => $tests, ], [ 'name' => 'string|alpha_dash', @@ -64,6 +71,7 @@ 'frontend' => ['string', Rule::in($availableFrontends)], 'auth' => ['nullable', 'string', Rule::in($availableAuthentication)], + 'tests' => ['string', Rule::in($availableTestFrameworks)], ] ); } catch (ValidationException $e) { @@ -88,6 +96,10 @@ if (array_key_exists('auth', $errors)) { return response('Invalid Authentication Provider. Please provide one supported Authentication Provider ('.implode(', ', $availableAuthentication).') or leave it empty (it will use laravel).', 400); } + + if (array_key_exists('tests', $errors)) { + return response('Invalid testing framework. Please provide one supported testing framework ('.implode(', ', $availableTestFrameworks).') or leave it empty (it will use pest).', 400); + } } $services = implode(' ', $with); @@ -98,6 +110,7 @@ //Prepend -- to frontend, auth and test $frontend = ($frontend) ? "--{$frontend}" : null; + $testFramework = ($tests) ? "--{$tests}" : null; /* * Adding a trailing space because if not on all tests i have to fix to @@ -107,8 +120,8 @@ $auth = ($auth) ? "--{$auth} " : null; $script = str_replace( - ['{{ php }}', '{{ name }}', '{{ frontend }}', '{{ authProvider }} ', '{{ with }}', '{{ devcontainer }}', '{{ services }}'], - [$php, $name, "$frontend", "$auth", $with, $devcontainer, $services], + ['{{ php }}', '{{ name }}', '{{ frontend }}', '{{ authProvider }} ', '{{ testFramework }}', '{{ with }}', '{{ devcontainer }}', '{{ services }}'], + [$php, $name, "$frontend", "$auth", "$testFramework", $with, $devcontainer, $services], file_get_contents(resource_path('scripts/php.sh')) ); From 221baf90313203ef485f2a2c2ea6f790d9d63936 Mon Sep 17 00:00:00 2001 From: Rogerio Pereira Date: Wed, 16 Apr 2025 22:17:00 -0400 Subject: [PATCH 08/16] test: Allow choose Testing Framework --- tests/Feature/Laravel12AuthTest.php | 4 +- tests/Feature/Laravel12Test.php | 2 +- tests/Feature/Laravel12TestFrameworkTest.php | 42 ++++++++++++++++++++ 3 files changed, 45 insertions(+), 3 deletions(-) create mode 100644 tests/Feature/Laravel12TestFrameworkTest.php diff --git a/tests/Feature/Laravel12AuthTest.php b/tests/Feature/Laravel12AuthTest.php index 0bb9a6d..12b09e1 100644 --- a/tests/Feature/Laravel12AuthTest.php +++ b/tests/Feature/Laravel12AuthTest.php @@ -13,7 +13,7 @@ public function test_it_accepts_no_authentication() $response = $this->get('/example-app'); $response->assertStatus(200); - $response->assertSee('laravel new example-app --livewire --no-interaction', false); + $response->assertSee('laravel new example-app --livewire --pest --no-interaction', false); } public function test_it_accepts_auth_workos() @@ -21,7 +21,7 @@ public function test_it_accepts_auth_workos() $response = $this->get('/example-app?auth=workos'); $response->assertStatus(200); - $response->assertSee('laravel new example-app --livewire --workos --no-interaction', false); + $response->assertSee('laravel new example-app --livewire --workos --pest --no-interaction', false); } public function test_it_does_not_accept_invalid_auth() diff --git a/tests/Feature/Laravel12Test.php b/tests/Feature/Laravel12Test.php index 677d1d0..02a6c97 100644 --- a/tests/Feature/Laravel12Test.php +++ b/tests/Feature/Laravel12Test.php @@ -13,6 +13,6 @@ public function test_it_should_update_laravel_installer() $response = $this->get('/example-app'); $response->assertStatus(200); - $response->assertSee('bash -c "composer global update laravel/installer && laravel new example-app --livewire --no-interaction && cd example-app && php ./artisan sail:install --with=mysql,redis,meilisearch,mailpit,selenium "', false); + $response->assertSee('bash -c "composer global update laravel/installer && laravel new example-app --livewire --pest --no-interaction && cd example-app && php ./artisan sail:install --with=mysql,redis,meilisearch,mailpit,selenium "', false); } } diff --git a/tests/Feature/Laravel12TestFrameworkTest.php b/tests/Feature/Laravel12TestFrameworkTest.php new file mode 100644 index 0000000..7b9c08e --- /dev/null +++ b/tests/Feature/Laravel12TestFrameworkTest.php @@ -0,0 +1,42 @@ +get('/example-app'); + + $response->assertStatus(200); + $response->assertSee('laravel new example-app --livewire --pest --no-interaction', false); + } + + public function test_it_accepts_test_pest() + { + $response = $this->get('/example-app?tests=pest'); + + $response->assertStatus(200); + $response->assertSee('laravel new example-app --livewire --pest --no-interaction', false); + } + + public function test_it_accepts_test_phpunit() + { + $response = $this->get('/example-app?tests=phpunit'); + + $response->assertStatus(200); + $response->assertSee('laravel new example-app --livewire --phpunit --no-interaction', false); + } + + public function test_it_does_not_accept_invalid_test() + { + $response = $this->get('/example-app?tests=invalid'); + + $response->assertStatus(400); + $response->assertSee('Invalid testing framework. Please provide one supported testing framework (phpunit, pest) or leave it empty (it will use pest).'); + } +} From 62cc71b1959187ddd0980a909940181981db9686 Mon Sep 17 00:00:00 2001 From: Rogerio Pereira Date: Wed, 16 Apr 2025 22:18:43 -0400 Subject: [PATCH 09/16] refactor/test: Fix old tests to comply with new laravel 12 installer --- tests/Feature/SailServerTest.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/Feature/SailServerTest.php b/tests/Feature/SailServerTest.php index 6dc1997..6fc4014 100644 --- a/tests/Feature/SailServerTest.php +++ b/tests/Feature/SailServerTest.php @@ -17,7 +17,7 @@ public function test_it_can_return_the_sail_install_script() $response->assertStatus(200); $response->assertSee("laravelsail/php84-composer:latest"); - $response->assertSee('bash -c "composer global update laravel/installer && laravel new example-app --no-interaction && cd example-app && php ./artisan sail:install --with=mysql,redis,meilisearch,mailpit,selenium "', false); + $response->assertSee('bash -c "composer global update laravel/installer && laravel new example-app --livewire --pest --no-interaction && cd example-app && php ./artisan sail:install --with=mysql,redis,meilisearch,mailpit,selenium "', false); } public function test_different_php_versions_can_be_picked() @@ -49,7 +49,7 @@ public function test_it_removes_duplicated_valid_services() $response = $this->get('/example-app?with=redis,redis'); $response->assertStatus(200); - $response->assertSee('bash -c "composer global update laravel/installer && laravel new example-app --no-interaction && cd example-app && php ./artisan sail:install --with=redis "', false); + $response->assertSee('bash -c "composer global update laravel/installer && laravel new example-app --livewire --pest --no-interaction && cd example-app && php ./artisan sail:install --with=redis "', false); } public function test_it_adds_the_devcontainer_upon_request() @@ -57,7 +57,7 @@ public function test_it_adds_the_devcontainer_upon_request() $response = $this->get('/example-app?with=pgsql&devcontainer'); $response->assertStatus(200); - $response->assertSee('bash -c "composer global update laravel/installer && laravel new example-app --no-interaction && cd example-app && php ./artisan sail:install --with=pgsql --devcontainer"', false); + $response->assertSee('bash -c "composer global update laravel/installer && laravel new example-app --livewire --pest --no-interaction && cd example-app && php ./artisan sail:install --with=pgsql --devcontainer"', false); } public function test_it_does_not_accepts_domains_with_a_dot() From 118563264bb28ee388a113606e12b5d85b967c56 Mon Sep 17 00:00:00 2001 From: Rogerio Pereira Date: Wed, 16 Apr 2025 23:27:18 -0400 Subject: [PATCH 10/16] feat: Include mongodb as an available service --- routes/web.php | 1 + 1 file changed, 1 insertion(+) diff --git a/routes/web.php b/routes/web.php index 1652fe3..515f19e 100644 --- a/routes/web.php +++ b/routes/web.php @@ -23,6 +23,7 @@ 'mailpit', 'selenium', 'soketi', + 'mongodb', ]; $availableFrontends = [ From 1666603562385c41c613bb11f9d9c13372b90279 Mon Sep 17 00:00:00 2001 From: Rogerio Pereira Date: Wed, 16 Apr 2025 23:28:00 -0400 Subject: [PATCH 11/16] chore: Rearrange available services so mongodb is close to other databases --- routes/web.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/routes/web.php b/routes/web.php index 515f19e..7e392d5 100644 --- a/routes/web.php +++ b/routes/web.php @@ -14,6 +14,7 @@ 'mysql', 'pgsql', 'mariadb', + 'mongodb', 'redis', 'valkey', 'memcached', @@ -23,7 +24,6 @@ 'mailpit', 'selenium', 'soketi', - 'mongodb', ]; $availableFrontends = [ From be45ffdacf63c5232bdeb131049e0d9635c7dfc0 Mon Sep 17 00:00:00 2001 From: Rogerio Pereira Date: Thu, 17 Apr 2025 00:28:24 -0400 Subject: [PATCH 12/16] test: Include mongodb as an available service --- tests/Feature/SailServerTest.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/Feature/SailServerTest.php b/tests/Feature/SailServerTest.php index 6fc4014..7125b73 100644 --- a/tests/Feature/SailServerTest.php +++ b/tests/Feature/SailServerTest.php @@ -89,7 +89,7 @@ public function test_it_does_not_accept_empty_with_query_when_present() $response = $this->get('/example-app?with'); $response->assertStatus(400); - $response->assertSee('Invalid service name. Please provide one or more of the supported services (mysql, pgsql, mariadb, redis, valkey, memcached, meilisearch, typesense, minio, mailpit, selenium, soketi) or "none".', false); + $response->assertSee('Invalid service name. Please provide one or more of the supported services (mysql, pgsql, mariadb, mongodb, redis, valkey, memcached, meilisearch, typesense, minio, mailpit, selenium, soketi) or "none".', false); } public function test_it_does_not_accept_invalid_services() @@ -97,7 +97,7 @@ public function test_it_does_not_accept_invalid_services() $response = $this->get('/example-app?with=redis,invalid_service_name'); $response->assertStatus(400); - $response->assertSee('Invalid service name. Please provide one or more of the supported services (mysql, pgsql, mariadb, redis, valkey, memcached, meilisearch, typesense, minio, mailpit, selenium, soketi) or "none".', false); + $response->assertSee('Invalid service name. Please provide one or more of the supported services (mysql, pgsql, mariadb, mongodb, redis, valkey, memcached, meilisearch, typesense, minio, mailpit, selenium, soketi) or "none".', false); } public function test_it_does_not_accept_none_with_other_services() @@ -105,6 +105,6 @@ public function test_it_does_not_accept_none_with_other_services() $response = $this->get('/example-app?with=none,redis'); $response->assertStatus(400); - $response->assertSee('Invalid service name. Please provide one or more of the supported services (mysql, pgsql, mariadb, redis, valkey, memcached, meilisearch, typesense, minio, mailpit, selenium, soketi) or "none".', false); + $response->assertSee('Invalid service name. Please provide one or more of the supported services (mysql, pgsql, mariadb, mongodb, redis, valkey, memcached, meilisearch, typesense, minio, mailpit, selenium, soketi) or "none".', false); } } From 38aceb8c8bb5852960f4843dcb04c5badb71579d Mon Sep 17 00:00:00 2001 From: Rogerio Pereira Date: Thu, 17 Apr 2025 00:29:44 -0400 Subject: [PATCH 13/16] feat: Fix docker command --- resources/scripts/php.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/scripts/php.sh b/resources/scripts/php.sh index 73772e9..dc57761 100755 --- a/resources/scripts/php.sh +++ b/resources/scripts/php.sh @@ -12,7 +12,7 @@ docker run --rm \ -v "$(pwd)":/opt \ -w /opt \ laravelsail/php{{ php }}-composer:latest \ - bash -c "composer global update laravel/installer && laravel new {{ name }} {{ frontend }} {{ authProvider }} {{ testFramework }} --no-interaction && cd {{ name }} && php ./artisan sail:install --with={{ with }} {{ devcontainer }}" + bash -c "composer global require laravel/installer && rm /usr/bin/laravel && ln -s ~/.composer/vendor/bin/laravel /usr/bin/laravel && laravel new {{ name }} {{ frontend }} {{ authProvider }} {{ testFramework }} --no-interaction && cd {{ name }} && php ./artisan sail:install --with={{ with }} {{ devcontainer }}" cd {{ name }} From ee375ee48234e5bcac5e1bb6ac5a8fcb0941c561 Mon Sep 17 00:00:00 2001 From: Rogerio Pereira Date: Thu, 17 Apr 2025 00:30:04 -0400 Subject: [PATCH 14/16] test: Fix docker command --- tests/Feature/Laravel12Test.php | 2 +- tests/Feature/SailServerTest.php | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/Feature/Laravel12Test.php b/tests/Feature/Laravel12Test.php index 02a6c97..760e8cf 100644 --- a/tests/Feature/Laravel12Test.php +++ b/tests/Feature/Laravel12Test.php @@ -13,6 +13,6 @@ public function test_it_should_update_laravel_installer() $response = $this->get('/example-app'); $response->assertStatus(200); - $response->assertSee('bash -c "composer global update laravel/installer && laravel new example-app --livewire --pest --no-interaction && cd example-app && php ./artisan sail:install --with=mysql,redis,meilisearch,mailpit,selenium "', false); + $response->assertSee('bash -c "composer global require laravel/installer && rm /usr/bin/laravel && ln -s ~/.composer/vendor/bin/laravel /usr/bin/laravel && laravel new example-app --livewire --pest --no-interaction && cd example-app && php ./artisan sail:install --with=mysql,redis,meilisearch,mailpit,selenium "', false); } } diff --git a/tests/Feature/SailServerTest.php b/tests/Feature/SailServerTest.php index 7125b73..812a6a6 100644 --- a/tests/Feature/SailServerTest.php +++ b/tests/Feature/SailServerTest.php @@ -17,7 +17,7 @@ public function test_it_can_return_the_sail_install_script() $response->assertStatus(200); $response->assertSee("laravelsail/php84-composer:latest"); - $response->assertSee('bash -c "composer global update laravel/installer && laravel new example-app --livewire --pest --no-interaction && cd example-app && php ./artisan sail:install --with=mysql,redis,meilisearch,mailpit,selenium "', false); + $response->assertSee('bash -c "composer global require laravel/installer && rm /usr/bin/laravel && ln -s ~/.composer/vendor/bin/laravel /usr/bin/laravel && laravel new example-app --livewire --pest --no-interaction && cd example-app && php ./artisan sail:install --with=mysql,redis,meilisearch,mailpit,selenium "', false); } public function test_different_php_versions_can_be_picked() @@ -49,7 +49,7 @@ public function test_it_removes_duplicated_valid_services() $response = $this->get('/example-app?with=redis,redis'); $response->assertStatus(200); - $response->assertSee('bash -c "composer global update laravel/installer && laravel new example-app --livewire --pest --no-interaction && cd example-app && php ./artisan sail:install --with=redis "', false); + $response->assertSee('bash -c "composer global require laravel/installer && rm /usr/bin/laravel && ln -s ~/.composer/vendor/bin/laravel /usr/bin/laravel && laravel new example-app --livewire --pest --no-interaction && cd example-app && php ./artisan sail:install --with=redis "', false); } public function test_it_adds_the_devcontainer_upon_request() @@ -57,7 +57,7 @@ public function test_it_adds_the_devcontainer_upon_request() $response = $this->get('/example-app?with=pgsql&devcontainer'); $response->assertStatus(200); - $response->assertSee('bash -c "composer global update laravel/installer && laravel new example-app --livewire --pest --no-interaction && cd example-app && php ./artisan sail:install --with=pgsql --devcontainer"', false); + $response->assertSee('bash -c "composer global require laravel/installer && rm /usr/bin/laravel && ln -s ~/.composer/vendor/bin/laravel /usr/bin/laravel && laravel new example-app --livewire --pest --no-interaction && cd example-app && php ./artisan sail:install --with=pgsql --devcontainer"', false); } public function test_it_does_not_accepts_domains_with_a_dot() From 961964e4cd51dbee57653edf8dfd694200a70f92 Mon Sep 17 00:00:00 2001 From: Rogerio Pereira Date: Thu, 17 Apr 2025 01:01:14 -0400 Subject: [PATCH 15/16] feat: Add instructions to run "sail npm install" and "sail npm run dev" after everything is done --- resources/scripts/php.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/resources/scripts/php.sh b/resources/scripts/php.sh index dc57761..7c43910 100755 --- a/resources/scripts/php.sh +++ b/resources/scripts/php.sh @@ -42,11 +42,11 @@ fi if $SUDO -n true 2>/dev/null; then $SUDO chown -R $USER: . - echo -e "${BOLD}Get started with:${NC} cd {{ name }} && ./vendor/bin/sail up" + echo -e "${BOLD}Get started with:${NC} cd {{ name }} && ./vendor/bin/sail up && ./vendor/bin/sail npm install && ./vendor/bin/sail npm run dev" else echo -e "${BOLD}Please provide your password so we can make some final adjustments to your application's permissions.${NC}" echo "" $SUDO chown -R $USER: . echo "" - echo -e "${BOLD}Thank you! We hope you build something incredible. Dive in with:${NC} cd {{ name }} && ./vendor/bin/sail up" + echo -e "${BOLD}Thank you! We hope you build something incredible. Dive in with:${NC} cd {{ name }} && ./vendor/bin/sail up && ./vendor/bin/sail npm install && ./vendor/bin/sail npm run dev" fi From f767051ebb21e9d0334c6d2365a6f964c8a25a32 Mon Sep 17 00:00:00 2001 From: Rogerio Pereira Date: Thu, 17 Apr 2025 01:29:48 -0400 Subject: [PATCH 16/16] chore: Fix typo in method name --- tests/Feature/Laravel12TestFrameworkTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/Feature/Laravel12TestFrameworkTest.php b/tests/Feature/Laravel12TestFrameworkTest.php index 7b9c08e..426f3e3 100644 --- a/tests/Feature/Laravel12TestFrameworkTest.php +++ b/tests/Feature/Laravel12TestFrameworkTest.php @@ -8,7 +8,7 @@ class Laravel12TestFrameworkTest extends TestCase { - public function test_it_accepts_no_authentication_and_uses_pest() + public function test_it_accepts_no_test_and_uses_pest() { $response = $this->get('/example-app');