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

@ember-data/codemods package #9343

Merged
merged 55 commits into from
May 8, 2024
Merged

@ember-data/codemods package #9343

merged 55 commits into from
May 8, 2024

Conversation

gitKrystan
Copy link
Contributor

@gitKrystan gitKrystan commented Apr 10, 2024

A new package for EmberData codemods. The first will be the legacy-compat-builders codemod to convert const foo = await store.findRecord('foo', '1') to const { content: foo } = await store.request(findRecord('foo', '1'), etc.

Description

  • Basic project setup
  • legacy-compat-builders codemod

Notes for the release

@gitKrystan gitKrystan added 🎯 canary PR is targeting canary (default) 🏷️ feat This PR introduces a new feature labels Apr 10, 2024
}

// prettier-ignore
runTests(
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

jscodeshift's default testing setup is missing some features, so I wrote my own.

For each codemod, we can add a folder in __testfixtures__ with the dasherized codemod name, and this test setup will run that codemod against all of the files contained therein. testName.input.ts will be modded and the result will be compared with testName.output.ts. You can also add testName.info.json with other useful stuff (e.g. config--not set up yet--or expected log output--see e.g. below).

example:

// testName.info.json
{
  "expectedLogs": [
    [
      "warn",
      "oh noes"
    ],
  ]
}

@runspired runspired merged commit 6a36dc9 into main May 8, 2024
18 checks passed
@runspired runspired deleted the codemods branch May 8, 2024 18:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🎯 canary PR is targeting canary (default) 🏷️ feat This PR introduces a new feature
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

2 participants