Skip to content
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

automatically detect musl, allow overriding target #109

Merged
merged 2 commits into from
Feb 3, 2025
Merged

Conversation

SteffenDE
Copy link
Contributor

Tailwind v4 includes binaries for linux-x64-musl and linux-arm64-musl. This commit adds support for automatically selecting those based on the system architecture. It also adds a config option to override the target, if necessary.

Relates to: #107

Tailwind v4 includes binaries for linux-x64-musl and linux-arm64-musl.
This commit adds support for automatically selecting those based on the
system architecture. It also adds a config option to override the target,
if necessary.
Copy link
Member

@josevalim josevalim left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good to me but shouldn't we do it only once we support v4.0? I think it will break for older versions, right? Or is the goal to make main about v4.0 exclusively?

@SteffenDE
Copy link
Contributor Author

@josevalim I'd only merge it after #107.

I think it will break for older versions, right? Or is the goal to make main about v4.0 exclusively?

It will, if you're on musl and want to use v3. You could override the target though, but that's not very comfortable.

So we'll need to decide if the goal is to still support Tailwind 3 and 4, or if we say: v0.3 of the library expects Tailwind 4, use v0.2 for v3. Another way would be to change the target selection code depending on the selected Tailwind version, but that could get complex fast.

@stefanchrobot
Copy link

Moving the comment from the other thread:

I think it would be best to incorporate your PR into this one and also update the list of targets: the musl binaries are only available for v4; also v4 no longer provides targets like "linux-armv7".

I think we can merge them separately as well, and then do a new release with all changes incorporated.

I'm not sure if we should remove the armv7 targets. You could use the new library version with Tailwind v3 as well. There's also the freebsd targets which aren't officially provided by Tailwind. If we do remove it, I think we should document which versions of Tailwind are expected to work with which version of the library.

If we want to support Tailwind v3, I'd love to see a better way to handle the targets. Previously we relied on the known targets and raised on an unsupported target. I think now there are going to be cases when we try to download the binary which doesn't exist. I think it'll fail with "This typically means we cannot reach the source or you are behind a proxy." which is pretty confusing.

I'd suggest doing this:

  • Add two code paths for v3 and v4 and check the requested target,
  • If the target is not known, log a warning,
  • Attempt to download the target either way,
  • Detect 404s and log a better error.

@josevalim
Copy link
Member

IMO we only support Tailwind v4 officially. There aren't any other changes in the project anyway and, if there is a need, we just do a new release in the v0.2 branch.

@SteffenDE SteffenDE merged commit dd1725a into main Feb 3, 2025
2 checks passed
@SteffenDE SteffenDE deleted the sd-musl branch February 3, 2025 11:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants