Improve @tailwindcss/upgrade
and pnpm
workspaces support
#18065
Merged
+185
−20
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR fixes an issue where an error such as:
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:
After:
Before:
After: