Upgrading Sanity Studio
How to upgrade Sanity Studio
Sanity Studio is distributed as an npm package, which means that upgrades are done as with any other dependency in package.json.
Upgrading with sanity@latest installs the current major version, which is v6. If your project is on an older major version, read the migration guide for each major you pass through first: Studio v3 to v4, Studio v4 to v5, and Studio v5 to v6.
To upgrade the core package for Sanity Studio, run:
npm install sanity@latestpnpm add sanity@latestyarn add sanity@latestbun add sanity@latestMake sure that your lock file (for example, package-lock.json) has been updated as well.
To confirm the upgrade, print the installed versions:
npx sanity versionspnpm dlx sanity versions
yarn dlx sanity versions
bunx sanity versionsThen restart your development server with npx sanity dev and check that the studio loads with the new version.
Upgrading plugins and other dependencies for Sanity Studio
As with the core sanity dependency, plugins and other dependencies are also upgraded by installing newer versions. You can also look into tooling like npm-upgrade and npm-check-updates that give you interactive CLI workflows for upgrading your dependencies. Code editors like VS Code also have extensions that list your dependencies and update them from the editor.
Deploying upgrades
After you have upgraded your Studio project's dependencies, you can deploy the new version depending on your deployment strategy:
- Run the
sanity deploycommand in your command line. - Or, check the changes into Git and push/merge to the branch that deploys the Studio to production.
We advise you to always check and track your Studio code into Git and push it to a remote Git repository. That way, you won't accidentally lose your work.
Automatic Studio upgrades
Using the built-in autoUpdates configuration property
If you deploy your Studio using the Sanity build tools, you can configure it to stay up to date automatically. Auto-updates apply new patch and minor releases. They also apply major releases that have no runtime effects, such as a change to the required Node.js version. Major releases that change how your Studio code behaves are not applied automatically.
Using Renovatebot
If you deploy Sanity Studio from GitHub (or other compatible platforms), then you can automate upgrades by setting up Renovatebot. We maintain the preset configuration for Sanity projects that you can reuse.
Go to the Sanity config presets on GitHub and follow the instructions to set it up.
Stay on top of what's new in the changelog
We publish updates to Sanity Studio up to every week. For each release of the Studio, we'll also post release notes on GitHub and in our changelog (that also covers other packages and APIs).
Changelog entries on sanity.io also mark any documentation article that was affected by the upgrade. Each affected article links its related entries in a "Related changelog entries" section.
When a release has breaking changes, the changelog entry includes migration instructions.