-
-
Notifications
You must be signed in to change notification settings - Fork 532
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
[2.0] Migration tool #5871
Comments
I spent some time thinking about this, and with more features implemented for 2.0. We want to create a tool that will actually help developers with migration. I don't think we should approach this by parsing the Razor file. There are so many things that can go wrong. Maybe it would work for a simple Razor file that just renames a parameter, but the rest is not so straightforward—it’s becoming clearer with all the updates we are bringing to 2.0. Not all migration steps can be decided by us. For example, the What I am suggesting is this:
What do you think? |
I like the Migration Assistant idea. But in the end, it is not different from building an app and seeing all the errors and warnings. It might be more details true. But is it going to be that much of a different to an end user? I am aware that the migration tool would not be perfect. If we could make it 50% good, even that would make it easy for our users to migrate. We need to focus primarily on razor syntax because that is how the majority of users write their Blazor(ise) code. In case there is a code-behind component reference, they can quickly fix it. In situations like |
PS. Even we brake the code somehow, they will try it, build it, and it will fail. Anx, they can easily undo changes with git. |
Ok, so what about combining the best of both worlds within the familiar UI of a programmer's IDE? I’m talking about custom analyzers (e.g., A good example of such an approach is Meziantou.Analyzer. While not used for migration, it simplifies working with Blazor. Advantages:
|
Can this analyzer change the user's code, or is it just for displaying errors and warnings? |
yes it can, these are called |
And does it work with razor code? If yes, it might be a good approach. |
It analyzes the generated files but can propagate warnings back to the Razor files, as seen here. (This behavior seems to be somewhat IDE-dependent, though.) I’m not entirely sure how this would work for Razor components usage - e.g. when renaming parameters—but I assume it should be possible. For instance, the I’ll start by checking the possibilities for renaming parameters. |
Please do, and see how it goes. PS. I've stumbled on this tool for refactoring APIs https://martinfowler.com/articles/codemods-api-refactoring.html. If something like this is possible with Blazor it would be great. |
There will be a lot of breaking changes in 2.0. And, I am thinking of how to make it easy for our users to migrate. One idea is to create a CLI tool that the users can install and the run on their project to automate the migration. We will need to parse razor code and replace any parameter on component that could be renamed.
Example
Rule 1 - two way binding
Rule 2 - one way binding
Rule 3 - manual two way binding
Rule 4 - no closing tag
Rule 5 - expressions
Rule 6 - Collapse in Accordion replaced by Accordion "inner" components
The text was updated successfully, but these errors were encountered: