feat: automatically generate ziggy types with vite #137
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Feat: Automate Ziggy Type Generation
This pull request introduces a new development dependency, vite-plugin-run, to automatically generate Ziggy type
definitions whenever relevant files are modified. This ensures that TypeScript always has the latest route information,
improving type safety and developer experience.
Key changes:
vite-plugin-run
: This Vite plugin allows running shell commands during development.vite.config.ts
: The configuration now automatically executes php artisan ziggy:generate --types-only tocreate resources/js/types/ziggy.d.ts when changes are detected in config/ziggy.php or any file under the routes/
directory.
resources/js/types/ziggy.d.ts
: The initial type definition file has been generated and included in thispull request.
Benefits:
parameters.
typos and errors.
Video Demonstration:
untitled.mp4