view_component-contrib icon indicating copy to clipboard operation
view_component-contrib copied to clipboard

If Webpack is not being used, user is not asked if they are using Stimulus; no index.js files are created by custom generator

Open unikitty37 opened this issue 1 year ago • 4 comments

What did you do?

Created a Rails app using the template.

What did you expect to happen?

I should have been asked if I used Stimulus, and the custom generator should have created the relevant .js files.

What actually happened?

I was not asked if I used Stimulus, because all the USE_STIMULUS code is wrapped in an if USE_WEBPACK block; I instead got a reference to #14.

Additional context

It would be better to ask the user if they're using Stimulus in all cases, then install the relevant config if Webpack is being used, otherwise give the reference to #14.

As a result, the custom generator does not have an option to create index.js, and the user must do it themselves each time.

Environment

Ruby Version: ruby 3.1.2p20 (2022-04-12 revision 4491bb740a) [aarch64-linux]

Framework Version (Rails, whatever): Rails 7.0.3.1

View Component Contrib Version: view_component-contrib (0.1.1)

unikitty37 avatar Aug 05 '22 09:08 unikitty37

Thanks for the report!

Agree, we should ask a user if they want to add Stimulus-related stuff to generators independently of whether Webpack is being used. Would you like to prepare a PR?

palkan avatar Aug 05 '22 15:08 palkan

Would you like me to tackle this?

helpotters avatar Aug 31 '23 18:08 helpotters

Hey @helpotters! Yes, please (if you're still interested)

palkan avatar Sep 15 '23 00:09 palkan

I'll check it out this weekend!

helpotters avatar Sep 16 '23 02:09 helpotters