preactjs / preact-www

:book: Preact documentation website.
https://preactjs.com
MIT License
358 stars 500 forks source link

feat: Codemods for Upgrading from Preact 8.x #1178

Open manishjha-04 opened 1 month ago

manishjha-04 commented 1 month ago

🚀 Feature Proposal

Building codemods for Upgrading from Preact 8.x Looking forward to add these and help Preact users have a smooth migration experience.

Motivation The motivation to create codemods is that it would streamline the process for millions of users, and also ensure that the application stays efficient and secure while leveraging the latest advancements in Preact.

Example These codemods would help migrate from Preact 8.x real quick as running :

npx codemod preact/X/migration-recipe

which would include all the codemods.

rschristian commented 1 month ago

Preact X has been out for over 5 years now, with Preact 8 having pretty few users.

I'm not sure this is really needed, and we'd probably need to do some testing before recommending it in our docs.

mohab-sameh commented 1 month ago

Preact X has been out for over 5 years now, with Preact 8 having pretty few users.

I'm not sure this is really needed, and we'd probably need to do some testing before recommending it in our docs.

@rschristian Thanks for the helpful insights. In this case, we can help make codemods for a migration that is more helpful and in need. If you have suggestions you'd like to see, please let me know.

Also, we should definitely pressure test any codemods before merging them to the upgrade doc. @manishjha-04 can you please turn this into a draft PR until everything is pressure tested?

rschristian commented 1 month ago

In this case, we can help make codemods for a migration that is more helpful and in need. If you have suggestions you'd like to see, please let me know.

Are you actively trying to make something Preact-related? Just curious, as the PR is a bit oddly timed given the age of the target (Preact X). That not necessarily a problem by any means, just wondering if this is a result of actively trying to make a Preact-specific code mod?

A major point of our ecosystem at the moment is a lack of breaking changes, so I don't think there's anything really out there. I suppose there's preact-router to preact-iso, but it's not 1:1, so I'm not sure you could automate it, nor do I think there's a big audience there ncessarily. That'd be the only thing that comes to mind.

mohab-sameh commented 1 month ago

In this case, we can help make codemods for a migration that is more helpful and in need. If you have suggestions you'd like to see, please let me know.

Are you actively trying to make something Preact-related? Just curious, as the PR is a bit oddly timed given the age of the target (Preact X). That not necessarily a problem by any means, just wondering if this is a result of actively trying to make a Preact-specific code mod?

A major point of our ecosystem at the moment is a lack of breaking changes, so I don't think there's anything really out there. I suppose there's preact-router to preact-iso, but it's not 1:1, so I'm not sure you could automate it, nor do I think there's a big audience there ncessarily. That'd be the only thing that comes to mind.

We had an interest in our community in codemodding low-hanging fruits that help improve OSS framework users' upgrade experience, and Preact had a clear and codemoddeable migration doc. I think we should've taken into account that such an older version may not be widely adopted anymore. Yeah, it doesn't hurt to have these anyway, but I agree that it makes more sense to tackle something more impactful.

Well, since we're at it, if you come across any best-practice or repetitive refactors you'd like to see, please let us know (our Slack community). Meanwhile, we can test these codemods and put them out there. Hopefully they might help someone one day.