Update your site
A BearMinion site has two parts that update separately:
- The library: the
bearminionpackage in yourpackage.json. It holds the editor, the content model and the Astro integration.npm installupdates it. - Your site’s own files: the sections, components,
src/libhelpers and page routes that were copied from the starter when the site was created. They are your code from then on, so no package update changes them. A release that fixes one of them, such as a section that draws differently, only reaches your site when you copy the new version in.
The commands below do that copying. They replace a file only when you never changed it, so your own edits are never lost.
Update
Run these in your site’s folder.
-
Commit first, so git is the undo.
-
Install the latest release:
Terminal window npm install bearminion@latestWith pnpm, yarn or bun:
pnpm add bearminion@latest,yarn add bearminion@latest,bun add bearminion@latest.A site made before 1.27 that wants a second language runs
npx bearminion add locale --files-onlyonce (Locales). -
See which of your files are behind:
Terminal window npx bearminion statusIt compares every file of your sections, and the shared files they import (atoms, molecules,
src/lib), with the release you just installed. It writes nothing. Each file iscurrent,outdated(you did not change it, the release did),missing(new in this release),edited(you changed it, the release did not),conflict(both changed it) ordiffers(it is not this release’s, and the site has no lock file to say who changed it). The full list is in The command line. -
Bring them up to date with the command
statusprints on its last line, for example:Terminal window npx bearminion add features hero media text-imageIt writes the missing files, replaces the outdated ones and leaves everything else alone. If it lists npm packages a section now needs, run the install command it prints, or pass
--install. -
Look at the files you changed. A section with a
conflictordiffersfile is left out of that command, becauseaddwould stop on it:Terminal window npx bearminion add media --diff # how your file differs from this releasenpx bearminion add media --overwrite # take this release's file and drop your changesMerge the release’s change into your file by hand when you want to keep your edits.
-
Check and commit:
Terminal window npx astro checknpm run buildOpen the site with
npm run dev, look at the pages that use the updated sections, and commit.
What the commands do not update
status and add handle sections and every file a section imports. A few files belong to no section:
| Files | How to update them |
|---|---|
src/pages/[...slug].astro, src/pages/404.astro, src/env.d.ts, src/components/seo/Seo.astro | With the online editor: npx bearminion add hosted updates them along with the other files the editor needs. Without it: copy them from the starter (templates/default/src) when the release notes name them |
| The route files for content types (sites made before 1.21) | npx bearminion add type --files-only |
astro.config.ts, src/components/sections/definitions.ts, src/lib/content-model.ts, your own sections | Never touched. They are yours; the release notes say when one needs a new line |
content/ | Nothing to do. When a release changes the content format, the site reads old files as they are and the editor rewrites each one in the new format the next time it saves it (see Content files) |
The release notes in CHANGELOG.md say which files a release changed.
How often
- A patch release (1.23.1 to 1.23.2) fixes bugs. When the fix is in a site file,
statusshows it. - A minor release (1.23 to 1.24) can bring new sections, options and fixes to site files.
- A major release (1 to 2) can change how sites are built, and comes with its own upgrade notes.
Updating every few releases is fine: status and add recognise files from any release back to 1.0, so skipping releases does not make updating harder. More on releases and the lock file in The command line.