mediamonks / pota

Pota :tipping_hand_person: tools to carry your projects
https://mediamonks.github.io/pota/
MIT License
12 stars 5 forks source link

new package - `update-pota` #51

Open psimk opened 2 years ago

psimk commented 2 years ago

The Why

One of the issues that pota has not yet solved is related to template updating - if you create a new project today with, v1.0.0 of the muban-template, and we later release a bugfix v1.0.1, then it will be up to you to manually edit your created project and add that bugfix. This is both annoying to the user, time consuming and also potentially error prone if there are a lot of changes, or they are complex.

To solve this, I suggest introducing a new CLI package update-pota that similar to create-pota, would download the template that the project has been bootstrapped with, diff that template with the project and then through a CLI prompt let the user apply any new changes.

Ideally we would track the commit hash of the template package and the version of it that was used to create the project and then compare those two hashes, creating a diff that could be applied onto the project. In case the user modified the project from the initial template, e.g. adding dependencies, then hopefully the diff would generate a merge conflict that could be resolved by the user.

As this would require some of the template related logic from create-pota, it would be smart to also extract that logic into a package that could be shared between update-pota and create-pota.


Tasks

These are quite general and should likely be turned into individual issues after some research is done.

ThaNarie commented 2 years ago

I think generating a diff (between two pota template versions) and applying that as a patch in the project, is the way to go. Otherwise you can never reliable detect what was changed by the user vs the updated template. Since pota is also responsible for creating the project in the first place, storing and using that information should be doable.