Marc Köhlbrugge
Update to Stimulus 2.0 #wip
Maker of things on the internet

Did you write a regular expression to do the migration?

Maker of WIP amongst other things.

@Jankeesvw Nope, did it the manual way. For each controller I grepped through the codebase and manually made the edits. With some vim find-and-replace magic of course. But more manual than I would have liked.

I did consider automating it in some way, but we have a bunch of different ways in our HAML views (and elsewhere) to define our targets so I couldn’t come up with a good approach.

There’s also some optional, but recommended functional changes you can make. Such as using value change callbacks to do some of your heavy lifting. I did those in the same go. Next time I’d probably break it up into smaller, shippable iterations.

Maker of things on the internet

I also upgraded my project, did 90% with a regular expression. But I only updated to the new target syntax.

Maker of WIP amongst other things.

@Jankeesvw Oh nice. Mind sharing that regex? Maybe worthy of a quick blog post.

Maker of things on the internet

@marc this is what I used, you still need some changes. But it gets you quite far.


A blog post sounds good, but this regular expression is not perfect some cases are not well replaced. So I'm not that happy with it.