-
-
Notifications
You must be signed in to change notification settings - Fork 4.8k
Improve @tailwindcss/upgrade and pnpm workspaces support
#18065
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
Merged
Merged
+185
−20
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
path … not in cwd when running upgrade tool@tailwindcss/upgrade and pnpm workspaces support
Contributor
|
Should we add tests for these two scenarios so we can make sure things keep working? |
When using pnpm with a workspace, if you happen to run the upgrade tool in the root because some Tailwind CSS dependencies live there, then you will get an error that you need the `--workspace-root` flag. However, if we _always_ add it, then the upgrade tool will add dependencies to the root, regardless of whether you are in a sub-packages. With this, the check doesn't happen and no error is thrown. This will just install/bump the dependencies where necessary.
e07b8f1 to
7aa017a
Compare
Member
Author
Good idea, added some failing tests in between commits and they got fixed by the followup commits |
philipp-spiess
approved these changes
May 19, 2025
1 task
This was referenced Nov 6, 2025
This was referenced Nov 7, 2025
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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
pnpmand your CSS file includes a@import "tailwindcss";. In this scenario,tailwindcsswill be loaded from a shared.pnpmfolder 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
-wor--workspace-rootflags are passed.For this, we disable the check entirely using the
--ignore-workspace-root-checkflag. If we always used the--workspace-rootflag, 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: