sveltejs / cli

The Svelte CLI
MIT License
258 stars 11 forks source link

FEATURE: add ability to select package version #281

Closed oneezy closed 1 week ago

oneezy commented 1 week ago

would be nice if there were a way to select which package version you wanted

for example, i want to use tailwind v4 (alpha) but sv only installs the latest version

maybe something like this:

|
|
o  What would you like to add to your project? (use arrow keys / space bar)
|  tailwindcss
|
*  Which version of tailwindcss would you like to add?
|     latest    (3.4.14)
|  >  next      (4.0.0-alpha.31)
|     custom
|
Conduitry commented 1 week ago

This doesn't sound like a good idea. I don't think we should be suggesting people install things other than the latest version of anything. If you know you want the Tailwind alpha, you can do that yourself, if you really know what you're doing and are prepared for whatever issues that may cause.

dominikg commented 1 week ago

yeah, that doesn't work. The add-on depends on the major version and switching to a different major is going to break what it does.

Esp. in this example tailwind@3 is completely different from tailwind@4 in terms of config and best practices. Once it is released as final we have to update our tailwind add-on to it. Before that, you'll get v3 and have to update manually.

This does raise a potential question on how existing projects that used the tailwind add-on with v3 can migrate it to v4, i have no answer to that, best guess is to follow tailwinds migration guide yourself or potentially run the add-on in an empty project and compare the differences to your setup.

manuel3108 commented 1 week ago

I think everything has been said.

benmccann commented 1 week ago

We did have an option to select between Svelte 4 and Svelte 5 beta. Doing the same for Tailwind wouldn't be insane if we properly label it as being pre-release and less recommended. But we should probably only do it if we want feedback about whether our setup and the Svelte toolchain works for it and doing so at alpha stage sounds perhaps a bit early. I'd probably be more open to it at the beta stage.

Conduitry commented 1 week ago

I don't think the Svelte CLI is under any obligation or reasonable expectation to treat pre-release versions of Svelte the same way that it treats pre-release versions of other software.

benmccann commented 1 week ago

Agreed that we're not under any obligation. But tons of Svelte users use Tailwind and if there's some Svelte/Tailwind compatibility issue I'd rather find that out before they have a final release so that we can give them any necessary feedback before they lock their API. And we're going to support Tailwind 4 anyway, so it doesn't cost us much to do that a little earlier

oneezy commented 1 week ago

i understand the concern with not including pre-release packages in the main sv cli but it would still be useful for guys like me and many more devs i suspect.

ive been using tw4 in all my new projects, similar to how all of us have been using svelte 5 way before rc because it was good enough. yeah, tw4 is completely different than tw3 as far as setup goes so that specific template would need to be modified.

This does raise a potential question on how existing projects that used the tailwind add-on with v3 can migrate it to v4

that does start to get a little tricky...and tw3 > tw4 is just one example. making that happen for every single scenario could be a bit much.

suggestion: if not allowing for specific versions of packages, what if there were a way to specify custom options through a sv.config.js file that the cli could read from? i have no idea what that would look like... but it would be nice to have a little bit more control of what gets installed and where