Skip to content

Conversation

@RobinMalfait
Copy link
Member

This PR is an internal refactor of the codemods package structure that will make a few follow-up PRs easier.

Essentially what happens is:

  1. Moved ./src/template/ into src/codemods/template/
  2. Moved ./src/codemods into ./src/codemods/css (because the CSS related codemods already)
  3. Moved the migration files for the JS config, PostCSS config and Prettier config into ./src/codemods/config/.
  4. Made filenames with actual migrations consistent by prefixing them with migrate-.
  5. Made sure that all the migration functions also use migrate…

When looking at this PR, go commit by commit, it will be easier. In a lot of cases, it's just moving files around but those commits also come with changes to the code just to update the imports.

[ci-all]

TypeScript was complaining in this file because `parseImportParams` can
return `null` but we didn't take that into account.
TypeScript was complaining that this was missing. While `undefined`
would've been falsey as well, this at least fixes the TypeScript
warning/error.
This will make it consistent with the CSS and Config migrations. In the
next commit, we will hoist the files because right now it looks like
`codemod/template/codemods`.
This moves the codemods for the templates up 1 directory. This will make
it consistent with the CSS and Config codemods setup.

This now means that `./src/codemods/template/codemods/*` becomes `./src/codemods/template/*`.
This is _just_ migrating the prefix string from let's say `tw-` to
`tw:`. Not migrating the prefix of each candidate in your template /
`@apply` files.
@RobinMalfait RobinMalfait force-pushed the refactor/codemods-structure branch from c26cbae to ec92fd4 Compare April 1, 2025 13:45
@RobinMalfait RobinMalfait marked this pull request as ready for review April 1, 2025 14:18
@RobinMalfait RobinMalfait requested a review from a team as a code owner April 1, 2025 14:18
@RobinMalfait RobinMalfait merged commit b94720a into main Apr 1, 2025
21 checks passed
@RobinMalfait RobinMalfait deleted the refactor/codemods-structure branch April 1, 2025 15:12
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.

3 participants