tailwindcss/integrations
Robin Malfait 71fb9cdf59
Improve @tailwindcss/upgrade and pnpm workspaces support (#18065)
This PR fixes an issue where an error such as:

<img width="1702" alt="image"
src="https://github.com/user-attachments/assets/4e6f75c7-3182-4497-939e-96cff08c55ae"
/>

Will be thrown during the upgrade process. This can happen when you are
using `pnpm` and your CSS file includes a `@import "tailwindcss";`. In
this scenario, `tailwindcss` will be loaded from a shared `.pnpm` folder
outside of the current working directory.

In this case, we are also not interested in migrating _that_ file, but
we also don't want the upgrade process to just crash.

I didn't see an option to ignore errors like this, so wrapped it in a
try/catch instead.

It also fixes another issue where if you are using a pnpm workspace and
run the upgrade tool from the root, then it throws you an error that you
cannot add dependencies to the workspace root unless `-w` or
`--workspace-root` flags are passed.

For this, we disable the check entirely using the
`--ignore-workspace-root-check` flag. If we always used the
`--workspace-root` flag, then the dependencies would always be added to
the root, regardless of where you are running the script from which is
not what we want.

## Test plan

Before:

<img width="1816" alt="image"
src="https://github.com/user-attachments/assets/78246876-3eb6-4539-a557-d3d366f1b3a3"
/>

After:

<img width="1816" alt="image"
src="https://github.com/user-attachments/assets/a65e4421-d7c5-4d83-b35d-934708543e25"
/>

Before:
 
<img width="1816" alt="image"
src="https://github.com/user-attachments/assets/53772661-2c4a-4212-84d9-a556a0ad320f"
/>

After:

<img width="1816" alt="image"
src="https://github.com/user-attachments/assets/5bfaf20e-34b8-44fd-9b59-e72d36738879"
/>
2025-05-19 12:47:08 +02:00
..
cli Fix source map paths in CI (#17938) 2025-05-08 22:56:49 +02:00
oxide Download platform specific package if optionalDependencies are skipped (#17929) 2025-05-09 14:55:02 +02:00
postcss Fix source map paths in CI (#17938) 2025-05-08 22:56:49 +02:00
upgrade Improve @tailwindcss/upgrade and pnpm workspaces support (#18065) 2025-05-19 12:47:08 +02:00
vite Upgrade lightningcss to 1.30.0 (#17979) 2025-05-12 15:49:18 +02:00
webpack Fix slow incremental builds (especially on Windows) (#17511) 2025-04-03 17:13:15 +02:00
package.json Update dedent 1.5.3 → 1.6.0 (minor) (#17965) 2025-05-10 13:21:48 +02:00
utils.ts Download platform specific package if optionalDependencies are skipped (#17929) 2025-05-09 14:55:02 +02:00
vitest.config.ts Improve integration tests (stability + performance) (#15125) 2024-12-12 13:48:56 +01:00