Updating Vuesion

Every Vuesion release is a complete archive, vuesion-<version>.tar.gz or vuesion-<version>.zip, without Git history. To take over a new release without losing your own changes, keep the unchanged releases on a separate branch and let Git merge them into your product.

Text
vuesion   1.7.0 ──────────── 1.8.0
            │                  │
            ▼                  ▼
main        ●── your work ──── ● merge
  • vuesion contains only unchanged Vuesion releases, one commit per release.
  • main is your product. It never receives commits on vuesion other than through merges.

Because both branches share the release you started from, Git only has to merge what changed between two releases.

Start a new project

Commit the unchanged release before changing anything:

Shell
tar -xzf vuesion-1.7.0.tar.gz
cd vuesion-1.7.0
git init -b vuesion
git add -A
git commit -m "chore: vuesion 1.7.0"
git switch -c main

Then continue with Installation and develop on main.

Add the branch to an existing project

If your repository starts with changed or unrelated code, create the vuesion branch from the release your project is on and record it as merged, without changing your files:

Shell
git switch --orphan vuesion
tar -xzf ../vuesion-1.7.0.tar.gz --strip-components=1
git add -A
git commit -m "chore: vuesion 1.7.0"
git switch main
git merge -s ours --allow-unrelated-histories vuesion -m "chore: track vuesion 1.7.0"

Run these commands without uncommitted changes. git switch --orphan empties the working tree except for ignored files.

Merge a new release

  • Read the RELEASE_NOTES.md of every version between your current and the target version.
  • Replace the content of vuesion with the new release. Removing the tracked files first makes sure that files deleted in the release are deleted on the branch:
    Shell
    git switch vuesion
    git rm -rq .
    tar -xzf ../vuesion-1.8.0.tar.gz --strip-components=1
    git add -A
    git commit -m "chore: vuesion 1.8.0"
    

    Ignored files, such as .env and node_modules, stay untouched.
  • Merge the branch into an update branch of your product. --no-commit stops before the merge commit, also when there are no conflicts:
    Shell
    git switch main
    git switch -c update-vuesion-1.8.0
    git merge --no-commit vuesion
    
  • Restore your migrations. Every release contains only its updated init migration, and Git takes it over without a conflict when you never changed it. An applied migration must never change:
    Shell
    git restore --source=HEAD --staged --worktree prisma/migrations
    
  • Resolve the conflicts:
    • For files you deleted, for example after a removal guide, keep them deleted with git rm <file>.
    • Merge package.json by hand, then take over the lockfile of the release and add your own dependencies again with npm install:
      Shell
      git checkout --theirs package-lock.json
      npm install
      
  • Complete the merge with git commit.
  • Create the migration for the schema changes and apply the remaining upgrade steps, as described in Updating Vuesion.
  • Run npm run lint and npm test, then merge the update branch into main.

Keep vuesion free of your own changes. A fix you need before the next release belongs on main; the next merge reconciles it with the release.

Next steps

Continue with Why Vuesion Exists to learn the ideas and principles that shaped the architecture of Vuesion.