Cli - update-package

Once users do frontity create the starter theme is cloned and they lose the ability to get updates from that theme.

Maybe we should include a frontity update-package @frontity/mars-theme command that downloads that package again and overwrites its content in the /packages folder.

In order to avoid unwanted overwrites it could check if git is present and everything is commited before running.

  • What do you think?
  • Could it work?
  • Would it be useful?
  • Would it be a good approach?

cc: @development-team

Another idea: create a new branch and commit the update there. The user then has to merge and resolve conflicts in the merge.

I don’t know if this feature is really necessary. In the moment somebody changes the code of mars-theme, it’s not mars-theme anymore. So each person should be responsible of the changes they have or if they want to reinstall the theme updated, do it by themselves? I mean, I don’t see the point on merging changes, etc.

Just my opinion :smile:

Maybe that’s something we can explain in a tutorial? I mean, teach people how to update their custom themes using git, instead of implement some kind of automated solution. And, at the same time, introduce git to newbies! :grin:

1 Like

Just for context: Theme developers usually offer updates to their themes: they solve bugs, they upgrade libraries, add new features, improve performance and so on.

Both WP and Gatsby manage theme updates with “child-themes” which is basically the opportunity to override any file with your own. That way the original code is not modified and can be updated without problems.

We can offer “child-themes” or we can offer a way to merge upstream changes with your own. Both have their own advantages and disadvantages. I thought we could start with the merges and see how it goes.

What would be the steps of reinstalling a theme?

I guess that the best choice is to do it like you said, updating in another branch and merging later. I didn’t know that the need of updating customized themes is something that existed. If it’s something that also WP does, then I guess we should do it as well.

The problem is that it is not so simple. You have to do an npm install of the package and then copy the package from node_modules to /packages in a branch and then do a merge. That steps are the ones that I think it’d be cool to automate in a create-package command.