blitz-js / blitz

⚡️ The Missing Fullstack Toolkit for Next.js
https://Blitzjs.com
MIT License
13.68k stars 798 forks source link

Upgrade existing Blitz apps with newapp template changes #3056

Open Vandivier opened 2 years ago

Vandivier commented 2 years ago

What do you want and why?

As a developer, I would like to be able to seamlessly upgrade my blitz project version using the cli, so that I can easily gain new features, bug fixes, and so on.

Possible implementation(s)

  1. modify docs and existing blitz new flow on file conflict
  2. create an altogether new cli command blitz upgrade or similar

Additional context

  1. current upgrade pattern seems to be like npx blitz@latest new myApp where you intentionally overwrite your existing app and resolve conflicts.
  2. Problematically, the current upgrade pattern seems to autocommit
  3. Another problem is that it seems the developer must manually and correctly remember their new myApp input selections (js vs ts, picking which form, etc)
Vandivier commented 2 years ago

if we pick an altogether new upgrade command then blitz can diff it's own versions internally and not try to write files which have not changed between versions, eg schema.prisma and others likely have low change rate and so there's no need for the user to even review file differences

beerose commented 2 years ago

I think there are two cases:

  1. New Blitz version doesn't have any newapp template changes — in that case yarn add blitz@latest (or using another package manager) should be enough (based on the recent releases, that's a common case).
  2. There are newapp template changes in the new Blitz version. In this case, the current blitz new ... would override your changes, which is not ideal. As a starter, we could document these changes in changelogs better. Otherwise, the command could suggest changes to these files that were modified in newapp template since your app version?