kit-clj / kit

Lightweight, modular framework for scalable web development in Clojure
https://kit-clj.github.io/
MIT License
463 stars 43 forks source link

Add possibility to remove modules #110

Open gerdint opened 11 months ago

gerdint commented 11 months ago

I.e. (kit/remove-module ) would do the inverse of kit/install-module

Would be useful in the case of failed experiments with a certain module.

yogthos commented 11 months ago

That might be a bit tricky because modules write to files in the project, and if the file is edited later then it could be difficult to tell where the code from the module is and whether it's safe to remove it.

gerdint commented 11 months ago

Yeah I can understand that this may be non-trivial to implement. One way would be to try to undo the module changes but bail out if there are any issues. I guess on underlying problem is the choice if the term "module", in that in reality the functionality is not really that modular at all (in the sense "self-contained"). And then there is the distinction to Kit "libraries" (which are actually modular in that sense), and the "profiles"...

yogthos commented 11 months ago

Yeah, ideally there would be a way to make modules truly modular, but that's a tricky problem in itself. The current modules are probably better described as templates. One thing that may be a reasonable compromise would be to remove the files added when a module is installed and then let the user know what code to remove from the existing project files. The modules already list the changes they make during the installation, so it would be easy enough to list that out. In most cases, the changes to existing files involve adding dependencies, requiring namespaces so they get loaded, and injecting components into system.edn. So, it shouldn't be too onerous on the user to roll these back manually.

gerdint commented 11 months ago

Yeah I've done the removal process by hand and in truth it's totally doable. So I understand if there are more highly prioritized things to work on. Coming up with a better term (be it template or not) may be the thing to start with...

jwhitlark commented 8 months ago

This is something I've missed, and have been thinking a bit about:

Writing this out, maybe a starting place would be to generate a "Removal report". People can follow it manually, and if it works well enough, then we could automate it?

yogthos commented 8 months ago

The removal report would probably be a good place to start, and we already produce a report for what's been installed. So, and easy quality of life improvement could be to persist the report from the installation and then add a command to print it out.