-
Notifications
You must be signed in to change notification settings - Fork 24
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
Don't download a new binary if one is already present. #87
base: main
Are you sure you want to change the base?
Conversation
Hey, nice work, can you please fix CS and tests |
Yep, sorry about that. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we need to tweak the docs as well: https://symfony.com/bundles/TailwindBundle/current/index.html#using-a-different-binary-version
bac7dc7
to
24c8321
Compare
Thanks for more changes, I still think we need to tweak the docs as well: https://symfony.com/bundles/TailwindBundle/current/index.html#using-a-different-binary-version To make it clear about the process of finding the binary, WDYT? |
@bocharsky-bw My apologies. I did not realize that the docs were in the same repository as the plugin. I've done my best to explain the changes, but feel free to make edits as needed 😅 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me, just a few minor comments
doc/index.rst
Outdated
update to a new version, delete your ``./var/tailwind`` directory before running | ||
``tailwind:build``. | ||
|
||
If instead you want to use only a specific version of tailwind, you can set the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If instead you want to use only a specific version of tailwind, you can set the | |
If instead, you want to use only a specific version of Tailwind, you can set the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My 2 cents here: for the exact same problem, on the minify bundle i added a --force
option to the install command.
DX feels easier to me (and can be added with little time).
Maybe another option?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We certainly could add a force flag. If the team is amenable to that, I can add that to this PR.
Co-authored-by: Victor Bocharsky <[email protected]>
Co-authored-by: Victor Bocharsky <[email protected]>
I'm curious: is this still required after #83? Unless you manually set the version to null, you'll always get a specific version. |
@kbond Required? No. But slapping a band-aid on the problem doesn't solve the underlying issue. Automatically pinning the version just tips the scale in the other direction- instead of having an issue where certain users expect a specific version but get a new one, after #83 you'll now have users expecting to get the latest version, but they'll get an outdated one. I opened this PR because the bundle didn't work as I expected. I presumed that when I ran
This is in line with how composer works, if, like me, you commit the However, what was happening was that it was always updating to the latest version every time I ran I think this PR, combined with an additional PR (which I'm happy to author), that informs users that their version is out of date, and provides clear and easy instructions on how to upgrade, would be the best solution to this problem. i.e. If a user hasn't set a pinned version, and their latest downloaded version is outdated, display a warning message during You are using tailwind v3.4.17, but the latest available version is v4.0.0.
Run php bin/console tailwind:update to use the latest version |
This is what #83 does. It's not perfect but aside from developing a composer-like versioning/update system, I think it's the best we have. This PR doesn't address the issue of a new developer or a CI downloading an unexpected version (because the binary isn't available in these cases). I'd be in favour of leaving the version config
I'm totally in favour of this but should look at your config, not the binary that's installed. |
The issue is that #83 sets the default version in the package itself, which means that as time goes on, that value will have to be updated as needed. When do we decide to set that number to v4.0.0? When is an appropriate time to upgrade? The answer will likely vary by company, by project, etc. Defaulting everyone to use the latest version that the tailwind-bundle that's confirmed to be compatible is different than defaulting to the latest version period.
This is by design. I was trying to preserve what I inferred was the intent of the plugin, so that existing users wouldn't be confused. If you want CI to work consistently, you need to pin every version of everything you can, that's why I love nix so much. This PR is based on the assumption that there are two kinds of users:
Frankly, I was just trying to help out so other users didn't fall in the same hole I did. If everyone is happy with #83, then feel free to close this PR. |
This is an interesting idea IMO, though is it possible? If so, it would be simpler (more straightforward) than trying to guess the latest installed version. It will solve the problem for new users, everything will happen out of the box and they will have the latest supported version of Tailwind. For current users - well, it will be a BC break but should be easy to fix, you just need to specify a binary version explicitly in your config. With this strategy even if reverted that #83 - it would still work for all as you want, no automatic jump to a newer version when released. To upgrade to a newer version - just change the version in your config file.
About this warning - I like it. We could check if there's a newer version available and if so - mention something like this in the output, but instead of saying run Wdyt? |
As discussed in #84, if a user has not configured a binary version, but has already downloaded an outdated tailwind binary, the outdated version will be used instead of downloading a new version.
This prevents builds from breaking when users unexpectedly are upgraded from v3.x to v4.
I could add a message that warns users they are not using the most up-to-date version, if necessary.