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

Improved codemod scope management #2264

Merged
merged 13 commits into from
Feb 17, 2025
Merged

Improved codemod scope management #2264

merged 13 commits into from
Feb 17, 2025

Conversation

ef4
Copy link
Contributor

@ef4 ef4 commented Feb 12, 2025

This refactors template-tag-codemod so that all cases can handle arbitrary existing scope collisions.

@ef4 ef4 added the internal label Feb 12, 2025
@ef4 ef4 changed the title More test coverage for codemod scoping Improved codemod scope management Feb 14, 2025
@ef4 ef4 added bug Something isn't working and removed internal labels Feb 14, 2025
@ef4
Copy link
Contributor Author

ef4 commented Feb 15, 2025

I still have one more bug to investigate in this area. I have an app where the codemod fails on the first run (where a prebuild is done) and succeeds the second time (when reusing prebuild).

@mansona
Copy link
Member

mansona commented Feb 17, 2025

@ef4 I've been working on something this weekend and I don't think that problem is isolated to just the codemod 🤔 I'm seeing the same behaviour when converting an app to Vite and it essentially fails the first run and then gets farther on the second (haven't fixed all the issues yet so can't say it succeeds on the second run 😂)

@ef4
Copy link
Contributor Author

ef4 commented Feb 17, 2025

Yeah, I agree. I think the codemod is just a good example to exercise the bug.

I'm going to land this. I regret not hitting merge on Friday because it would have avoided confusion and conflicts with #2271

@mansona
Copy link
Member

mansona commented Feb 17, 2025

sorry that was my bad 🙈 I looked for this PR to see if it was merged before merging that, I just missed it 🙃

@ef4 ef4 merged commit 04eb47b into main Feb 17, 2025
436 checks passed
@ef4 ef4 deleted the codemod-scoping branch February 17, 2025 14:49
@github-actions github-actions bot mentioned this pull request Feb 17, 2025
ef4 added a commit that referenced this pull request Feb 17, 2025
This fixes #2264 (comment) and also addresses automatically adding `exports` to package.json, since they're both in the same function.

The problem with first-run failures was that Resolver expects to get constructed after any prebuilding is done. We were constructing it in ensureAppSetup before the prebuild.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants