diff --git a/.gitignore b/.gitignore index df6469a..7c7cab4 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,11 @@ /vendor/ .cache -.tempest \ No newline at end of file +.tempest +# testbench related files +.vite +vite-tempest +node_modules +public/build/ +package.json +package-lock.json +log/ \ No newline at end of file diff --git a/composer.json b/composer.json index 212adeb..683ae8e 100644 --- a/composer.json +++ b/composer.json @@ -13,7 +13,8 @@ }, "autoload-dev": { "psr-4": { - "NeoIsRecursive\\Inertia\\Tests\\": "tests/" + "NeoIsRecursive\\Inertia\\Tests\\": "tests/", + "Testbench\\": "testbench/" } }, "scripts": { diff --git a/public/index.php b/public/index.php new file mode 100644 index 0000000..162340f --- /dev/null +++ b/public/index.php @@ -0,0 +1,14 @@ +run(); + +exit(); diff --git a/src/Installer/InertiaInstaller.php b/src/Installer/InertiaInstaller.php index 3c4a15b..78e87a7 100644 --- a/src/Installer/InertiaInstaller.php +++ b/src/Installer/InertiaInstaller.php @@ -98,21 +98,19 @@ private function installReact(string $clientPath, string $pagesPath): void destination: (string) path($clientPath, $pagesPath, 'example-page.tsx'), ); - $this->write( - contents: <<<'CODE' - To make vite bundle jsx and enable fast refresh, you need the @vitejs/plugin-react plugin. - We have installed it for you, but you need to add it to your Vite config. - - import react from '@vitejs/plugin-react'; - // ... - export default defineConfig({ - plugins: [ - // ... other plugins - react(), - ], - }); - CODE, - ); + $this->write(contents: <<<'CODE' + To make vite bundle jsx and enable fast refresh, you need the @vitejs/plugin-react plugin. + We have installed it for you, but you need to add it to your Vite config. + + import react from '@vitejs/plugin-react'; + // ... + export default defineConfig({ + plugins: [ + // ... other plugins + react(), + ], + }); + CODE); } private function installVue(string $clientPath, string $pagesPath): void @@ -147,20 +145,18 @@ private function installVue(string $clientPath, string $pagesPath): void destination: (string) path($clientPath, $pagesPath, 'example-page.vue'), ); - $this->write( - contents: <<<'CODE' - Vite requires a plugin to parse Vue files. - We have installed it for you, but you need to add it to your Vite config. - - import vue from '@vitejs/plugin-vue'; - // ... - export default defineConfig({ - plugins: [ - // ... other plugins - vue(), - ], - }); - CODE, - ); + $this->write(contents: <<<'CODE' + Vite requires a plugin to parse Vue files. + We have installed it for you, but you need to add it to your Vite config. + + import vue from '@vitejs/plugin-vue'; + // ... + export default defineConfig({ + plugins: [ + // ... other plugins + vue(), + ], + }); + CODE); } } diff --git a/tempest b/tempest new file mode 100755 index 0000000..6507d32 --- /dev/null +++ b/tempest @@ -0,0 +1,13 @@ +#!/usr/bin/env php +run(); + +exit; diff --git a/testbench/TestController.php b/testbench/TestController.php new file mode 100644 index 0000000..4e416d3 --- /dev/null +++ b/testbench/TestController.php @@ -0,0 +1,21 @@ +