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

feat: Create codemod for v0.39.0 -> v0.40.0 #259

Merged

Conversation

wschurman
Copy link
Member

@wschurman wschurman commented Feb 24, 2025

Why

The PRs downstack from this one introduce a number of breaking changes to the syntax for create/update/delete/load-association of entities.

While typescript is sufficient to detect where the breaking changes affect an application that uses entity, it is not sufficient to update them. For large applications, this migration would be impossible without a tool to automatically update most callsites. For example, upon dry-running an upgrade of these packages in the Expo server, tsc reports 2204 errors in 444 files.

This PR adds a jscodeshift codemod for the bulk of the breaking changes.

Some notable exceptions that are not covered by the codemod:

  • Split up mutators. These will need to be converted manually:
    const creator = TestEntity.creator(vc);
    await creator.createAsync();
    
  • The association loader move of the queryContext parameter (portion of feat!: Add enforcing entity association loader #257). tsc should be sufficient to find places this needs to be updated manually.

How

Create a jscodeshift transform to perform the normal-case transformation from #253. This was created mostly TDD.

Test Plan

  1. Run automated test.
  2. Manually upgrade the packages on the Expo server repository, tsc before and after running the codemod, see it auto-fixes all but ~250 errors. (~90%).

@wschurman wschurman force-pushed the @wschurman/02-20-feat_add_enforcing_entity_association_loader branch from 863332f to adcaf3b Compare February 24, 2025 03:16
@wschurman wschurman force-pushed the @wschurman/02-23-feat_create_codemod_for_v0.39.0_-_v0.40.0 branch from 01b2606 to 7be217a Compare February 24, 2025 03:16
@wschurman wschurman changed the base branch from @wschurman/02-20-feat_add_enforcing_entity_association_loader to graphite-base/259 February 24, 2025 03:33
@wschurman wschurman force-pushed the @wschurman/02-23-feat_create_codemod_for_v0.39.0_-_v0.40.0 branch from 7be217a to 857a69b Compare February 24, 2025 03:35
@wschurman wschurman changed the base branch from graphite-base/259 to main February 24, 2025 03:36
@wschurman wschurman force-pushed the @wschurman/02-23-feat_create_codemod_for_v0.39.0_-_v0.40.0 branch 2 times, most recently from 828daef to 4937a66 Compare February 24, 2025 04:26
Copy link

codecov bot commented Feb 24, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 100.00%. Comparing base (c6f74a1) to head (9d27f21).
Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff            @@
##              main      #259   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           80        80           
  Lines         2053      2053           
  Branches       277       277           
=========================================
  Hits          2053      2053           
Flag Coverage Δ
integration 100.00% <ø> (ø)
unittest 100.00% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@wschurman wschurman force-pushed the @wschurman/02-23-feat_create_codemod_for_v0.39.0_-_v0.40.0 branch 2 times, most recently from de4134d to 8f868b2 Compare February 24, 2025 05:36
@wschurman wschurman marked this pull request as ready for review February 24, 2025 05:48
@wschurman wschurman requested review from ide and quinlanj February 24, 2025 05:48
@wschurman wschurman force-pushed the @wschurman/02-23-feat_create_codemod_for_v0.39.0_-_v0.40.0 branch from 8f868b2 to 9d27f21 Compare February 24, 2025 16:25
@wschurman wschurman merged commit d63ddd6 into main Feb 24, 2025
4 checks passed
@wschurman wschurman deleted the @wschurman/02-23-feat_create_codemod_for_v0.39.0_-_v0.40.0 branch February 24, 2025 20:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants