Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[11.x] Support Single and Multi-Selection for Publishing Stubs #53757

Open
wants to merge 7 commits into
base: 11.x
Choose a base branch
from

Conversation

ahinkle
Copy link
Contributor

@ahinkle ahinkle commented Dec 4, 2024

This PR adds support for single and multi-selection using Laravel Prompts in the stub:publish artisan command.

Screen.Recording.2024-12-04.at.10.43.23.AM.mov

The stub:publish command currently publishes all customizable stubs, which now includes 52 stubs. With this change, it adds flexibility for developers who only need to customize a few specific stubs.

  • You can now choose which stubs to publish directly from a selection menu, making it easier to target just the stubs you need.

  • --all Option: If you prefer to publish everything, the --all flag skips the menu and works just like it does today.

Examples:

Interactive Mode:

Simply run:

php artisan stub:publish

and select one or more stubs from the list:
image

End Result:

image

Publish All:

Use the --all flag to publish everything at once:

php artisan stub:publish --all

image

@taylorotwell
Copy link
Member

I think we should limit this prompt to the most commonly customized stubs and give them human friendly names rather than file names. 👍

@taylorotwell taylorotwell marked this pull request as draft December 8, 2024 15:48
@ahinkle
Copy link
Contributor Author

ahinkle commented Dec 10, 2024

Thanks! Made a few updates.

  • I updated the names to be more human-readable. After reviewing, I realized that reading the names left to right didn’t feel natural. Leading with the secondary descriptor (e.g., "Invokable Controller" instead of "Controller Invokable") makes them easier to understand.

  • I reviewed our laravel apps to find the most commonly used stubs and narrowed the list to focus on essentials. Models, controllers, migrations, seeders, factories, tests (+ Pest), resources, notifications, mailables, and jobs. This reduced the list from 52 to 31 stubs. I’d love to hear your thoughts on whether this selection feels right or needs some adjustments.

  • Since we’re now focusing on common stubs, what do you think about adding a --list-all flag to show the full list of available stubs? This could be useful for developers looking for less common ones.

SCR-20241209-rrir SCR-20241209-rrkn

@ahinkle ahinkle marked this pull request as ready for review December 10, 2024 02:44
@ahinkle ahinkle changed the title Support Single and Multi-Selection for Publishing Stubs [11.x] Support Single and Multi-Selection for Publishing Stubs Dec 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants