livewire / volt

Volt is an elegantly crafted functional API for Livewire.
https://livewire.laravel.com/docs/volt
MIT License
312 stars 19 forks source link

Make class component if project uses Volt Class components #106

Closed joshcirre closed 1 month ago

joshcirre commented 1 month ago

I appreciate the check that make:test provides when you are using a starter kit or already have a Pest or a PHPUnit test created in the project, and I think it makes a great addition to Volt, as well.

I always forget to add the --class option when creating a new Volt component for my projects.

This adds a usingClass function to check to see if any Livewire Volt components already exist in the Volt::paths() and if that is identified as a Class component, then it will default to using the Class component stub when the volt:make command is run.

Additionally, I did add a --functional option to the command due to the fact that there are some folks who might want Class & Functional components to exist in the same project. While that can be written manually, I figured it wouldn't hurt to have an additional option, just in case.