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

[make:stimulus-controller] Add classes support, generate usage code, fix doc, add tests #1631

Open
wants to merge 12 commits into
base: main
Choose a base branch
from

Conversation

smnandre
Copy link
Member

Hello,

this PR adds new features to the Stimulus controller maker (and updates minor things)

  • Add "default" methods (initialize, connect, disconnect) in generated code, with explanation of what they do and example of usage, to encourage good practices for event listeners
  • Add cli option --typescript (shorcut: -ts) to choose extension from command line
  • Add feature to generate classes attributes interactively
  • Add code usage example at the end, to avoid (frequent) mistakes with data attribute placement or markup
  • Cover new features with tests

Also

  • Fix documentation links (StimulusBridge -> StimulusBundle)
  • Set Javascript as default extension in interactive step
  • Add missing tests for values

Most of things here are based on feedback received or mistakes seen frequently... but everything is of course very open to debate and suggestions 🤗

I tried to make a clean commit history to ease review, but if you do want, i can split this PR.

PS: I intentionally did not add outlets to this maker. They are a very advanced feature that can often lead to debatable choices in terms of component architecture, isolation, and more.

@smnandre smnandre changed the title [Stimulus] Make controller with classes, generate usage code, fix doc, add tests [make:stimulus-controller] Add classes support, generate usage code, fix doc, add tests Dec 25, 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.

1 participant