-
Notifications
You must be signed in to change notification settings - Fork 40
💫 A big rewrite #328
Comments
@BlankParticle Yes, Yes! Yes, Yes! Yes, Yes! TLDR; I totally agree with you in nearly all the points. As I have dig deeper and deeper in the last weeks / months I had similar thoughts pretty recently. First of all I want to have a look on some of your points from J's perspective (original author of svelte-add). Please move away from submodulesJ used the separate github repos as a way to promote the different adders via SEO, because no website existed. Based on the search ranking I, and probably a lot of other users, have experienced, this worked exceptionally well. Better Adder APIBefore the first big rewrite happened, everything was just a few files that were "copy-pasted" inside everyone's project. Unfortunately this caused different adders overriding each others configuration and did not work properly for existing projects. Based on that, the current state was already a massive improvement. Now that we have this out of the way, let's get into my personal opinions and thoughts! Please move away from submodulesAbsolutely! In fact I was already preparing a small website, to take over the SEO part. The site is actually present in this repo and deployed, but not linked anywhere because it's not nearly finished. Submodules are a maintenance Burdon and it makes it pretty hard to run the testcases on the adders in the other repos. Better Adder APII'm not completely sure about the project/NPM setup yet, but I really like the idea. As of right now, I worked on multiple other adders, but never managed to published them because of weird AST behaviors or my incapability to correctly work with AST's. No matter what, I would like to abstract this as far away as possible as you proposed. CheckpointsBased on the things I have done in this repo in the past, I think it would be required that we would have some kind of integration testing of some sort. It happened multiple times, that I changed something and deployed it, and got feedback that in some things did not work in some combinations. Sure, we cannot catch everything, but we should be able to catch a lot more than we are currently. Currently we only have test in place, to see if the adder got applied correctly and the dependencies could be installed successfully. Third-party AddersExactly. ExtrasNot sure about TS yet, but seeing the current state of this repository pretty much makes this a must. But I have not played with TS too much over the past years, so I would probably need to try it again. Additional thoughts
Closing thoughtsYes, you are absolutely right, so thank you so much for mentioning this. In fact in the past I already worked on a rewrite in the past (before being maintainer here), but back then I abandoned the idea. |
To be honest I hate the versioning system that is happening in this repo, I think it would be far better to use So I think we might need to create a project, we could name them like Also if we are going to do a rewrite we should make a unified Adder api, most project that are made for svelte use their own methods, If the can port the existing adders to this new api, we could convince projects like Skelton, daisyUi to use the unifed Api to avoid wired conflicts. Also If we take control over the core and provide the utilities for building out a schema then handling breaking changes with svelte would be much easier. So now it's upto you, if you want to create new package or continue with this one. If we want to create a new package then I have a project structure in mind.
Any thing you might choose, I would be happy to help out. |
Sure, I would love to help when you get the ground up. |
Not going to pin this right now, as I expect this to be a process that will last at least several weeks.... |
@BlankParticle Actually, I changed my mind. I have just invited you to the repo. In the readme you will find a link to I would especially be interested in your feedback on the Thanks so much for your help! |
Sure, I will look into this tomorrow |
Just to give everyone a short update: Everything started coming together pretty recently. Overall I can say, that the hard work is done by now. Especially the AST manipulation took me many tries to find a syntax that naked sense, is short and powerful. Apart from that I currently have three composers (tailwindcss, mdsvex, bulma) that are currently working. I hope that I can get most of the things done within the next month or so to be ready when svelte 5 releases. There is still lots of things to do (without order):
|
Hey sorry, I was the one who proposed the change, but I recently had not chance to work with svelte, so I had not been able to work on this. |
No problem at all. Really loved your input though, and many of the things we discussed are still applicable today. Just wanted to give an update for anyone seeing this issue |
This is supported by |
As the title suggests, I think
svelte-add
needs some fundamental changes. It is not broken but also not in a good shape, take #312 or #285 for example, they can be fixed with little bit of logic here and there, but that will not fix the fundamental issue that is lack of project context in adders.The Proposals
Here are some proposals I have, they are individually debatable and I don't expect everyone to agree on everything
Please move away from submodules
Git submodules aren't the best thing to work with. I have read #12 and understand the gist of it, still I think a monorepo would be the best thing. The last thing anyone want to do is deal with submodules shenanigans.
Also on a personal note, when I looked at the
tailwindcss
adder it took me way long to realized how it worked with only 3 js files and no package.json or anything. Then I opened__run.js
and got more confused by the imports outside of the repo, until I realized I had to look fromsvelte-add
to userstand what was happening.my suggestion is to archive the other repos and move everything to this central repo. One of the closest match to this kind of setup can be found in https://github.com/catppuccin/userstyles
Better Adder API
Current implementation of adder with
__run.js
is lacking at many places, what I suggest is to separate out the core utilities in their specific packages like@svelte-add/core
orsvelte-add-core
and ship it as a dependency withsvelte-add
with the Adders. I promise it will make more sense later.Now for the adders, instead of exporting bunch of random const from bunch of random files, we can have only one
export default defineAdder()
, just like how vite does it.Now to userstand how it helps here is a hypothetical implementation of
tailwindcss
adder.We just defined a set of instructions for the adder, now it's the job of
core
to handle everything. We don't need to handle any cases where there is changes in default svelte config, the user is in a monorepo or any other issues. Also the adder is just defining schema, it will not change anything on files. Thencore
will look at the schema try to apply it, if anything goes wrong restore original files so that the user is not left with a half broken project.Checkpoints
Checkpoints is just a fancy term for a test suite for the adder. If we want to check if A adder was run successfully we run this suite which will ensure it.
For
tailwindcss
the suite may look like this.hasPackage("tailwindcss")
,hasPackage(/*Other ones*/)
,hasConfigFile(/tailwindcss.config.m?(t|j)s/)
, etc.Then for a adder like
skeleton.dev
we can just slap it with adependsOn("tailwindcss")
, it will ensure tailwindcss is installed before addingskeleton.dev
other wise prompt the user to installtailwindcss
and run it's adder.Third-party Adders
Third party adders can be boiled down to just a
export default defineAdder()
, We can show user a warning about the third party adder. Otherwise it should be pretty easy to get schema from any third-party adder and apply it.Extras
I might have some more ideas which I will edit in later. We can discuss and make changes to this proposal as you like.
Thanks ❤️
The text was updated successfully, but these errors were encountered: