zwilias / elm-json

Install, upgrade and uninstall Elm dependencies
MIT License
182 stars 9 forks source link

Support for upgrading code with packages #57

Open gampleman opened 7 months ago

gampleman commented 7 months ago

I'd like to establish a convention such that if a package contains an upgrade/Upgrade.elm file at the top level, than the package indicates that it can automatically update user code along with itself. This is at the moment best achieved via elm-review. Such an Upgrade.elm file would contain a dictionary of source versions to review configurations. The proposal would be that elm-json would detect when a user wishes to upgrade such a package and would offer the user to also modify their codebase. It would do this by dynamically generating an elm-review configuration based on the users current version of the dependency, then running elm-review --fix-all.

lue-bird commented 7 months ago

If feel like this would stretch the scope of elm-json too much. So far it has been just a tool to correctly edit the elm.json config file; with this change it would change your code, have elm-review and a github query package as a depencency etc.

In my eyes, the idea is cool but I worry it messes with elm-json "doing one thing, and one thing well" as a user expectation. So maybe this is better as it's own project using elm-json and elm-review?

gampleman commented 7 months ago

Perhaps, but I think you are looking at the "one thing" from the perspective of a developer of tooling, not from the perspective of user of tooling.

From the perspective of a user, I don't particularly care what dependencies need to be added or exactly how this works, I want to have one tool to manage my dependencies. It would be best if that tool was elm, but for better or worse in practice that tool is elm-json.

Last thing I want to remember is that I can use elm-json to add, remove, and do patch and minor updates of packages, but for major updates I'm supposed to use elm-upgrade or whatever because... reasons.


That said, if the behaviour that changes your code was behind a flag or some such, that would be fine with me, if we believe that it would be against user expectation to do this by default.