From 49484f0491f44d1f4afffff2c660bb4c60cd7b6d Mon Sep 17 00:00:00 2001 From: Robin Malfait Date: Thu, 14 Nov 2024 11:31:05 +0100 Subject: [PATCH] Do not migrate legacy classes with custom values (#14976) This PR fixes an issue where we migrated classes such as `rounded` to `rounded-sm` (see: https://github.com/tailwindlabs/tailwindcss/pull/14875) However, if you override the values in your `tailwind.config.js` file, then the migration might not be correct. This PR makes sure to only migrate the classes if you haven't overridden the values in your `tailwind.config.js` file. --------- Co-authored-by: Philipp Spiess --- CHANGELOG.md | 2 + integrations/upgrade/index.test.ts | 199 +++++++++++++++++- integrations/utils.ts | 14 ++ .../src/codemods/migrate-at-apply.ts | 21 +- .../src/template/codemods/important.ts | 66 +----- .../template/codemods/legacy-classes.test.ts | 36 ++++ .../src/template/codemods/legacy-classes.ts | 156 ++++++++++++++ .../codemods/simple-legacy-classes.test.ts | 17 -- .../codemods/simple-legacy-classes.ts | 21 +- .../src/template/is-safe-migration.ts | 62 ++++++ .../src/template/migrate.ts | 12 +- 11 files changed, 496 insertions(+), 110 deletions(-) create mode 100644 packages/@tailwindcss-upgrade/src/template/codemods/legacy-classes.test.ts create mode 100644 packages/@tailwindcss-upgrade/src/template/codemods/legacy-classes.ts create mode 100644 packages/@tailwindcss-upgrade/src/template/is-safe-migration.ts diff --git a/CHANGELOG.md b/CHANGELOG.md index f0addeb79..9f69170b7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Fixed - Ensure that CSS inside Svelte `