---
myst:
  html_meta:
    "description": "Upgrade a frontend that builds on a Volto distribution, keep its packages in step with the distribution, and stamp the Volto version when you release a distribution."
    "property=og:description": "Upgrade a frontend that builds on a Volto distribution, keep its packages in step with the distribution, and stamp the Volto version when you release a distribution."
    "property=og:title": "Upgrade a Volto distribution"
    "keywords": "Plone, repoplone, Volto, distribution, upgrade, release-it, volto_version"
---

(how-to-upgrade-a-volto-distribution)=

# Upgrade a Volto distribution

This guide shows you how to upgrade a frontend whose base package is a {term}`Volto distribution`.
It also shows how to release a distribution so that projects built on it can follow it.

(how-to-upgrade-a-volto-distribution-configure)=

## Name the distribution as the base package

A frontend built on a distribution names it as its base package.
Without components, set it on the primary Node package.

```toml
[[package]]
type = "node-volto"
name = "my-site"
path = "frontend/packages/my-site"
base_package = "@kitconcept/volto-intranet"
```

With components, set it on the component instead.

```toml
[[component]]
name = "frontend"
type = "node-volto"
path = "frontend"
base_package = "@kitconcept/volto-intranet"
```

(how-to-upgrade-a-volto-distribution-upgrade)=

## Upgrade the frontend

Upgrade to the latest release of the distribution.

```shell
uvx repoplone deps upgrade frontend
```

Or to a version of your choice.

```shell
uvx repoplone deps upgrade frontend 3.0.0
```

repoplone pins the distribution in the `package.json` of the frontend.
When the distribution's published `package.json` has a `volto_version` field, repoplone also does the following.

- It fetches the versions the distribution enforces, and its `volto_version`, from the npm registry.
- It writes them to `distribution.json` at the root of the frontend workspace.
- It aligns the `@plone/volto` tag in `mrs.developer.json` with the distribution's `volto_version`.

The project's `.pnpmfile.cjs` hook reads `distribution.json` and overrides those versions across the workspace when pnpm installs it.
repoplone then runs `make frontend-install`, which updates the lockfile.

`repoplone deps check` and `repoplone versions dependencies` report both the distribution and the Volto core version it uses.

(how-to-upgrade-a-volto-distribution-release)=

## Stamp the Volto version when you release a distribution

A distribution advertises the Volto core version it targets with a `volto_version` field in its `package.json`.
Projects built on the distribution read that field when they upgrade.

Stamp the field when you release the distribution.
In the distribution package's `.release-it.json`, run the stamp after the version bump.

```json
{
  "hooks": {
    "after:bump": [
      "uvx repoplone deps stamp-volto-version",
      "git add package.json"
    ]
  }
}
```

`deps stamp-volto-version` reads the `@plone/volto` tag from `mrs.developer.json` and writes it, unchanged, to the `volto_version` field of the primary Node package's `package.json`.
It finds `repository.toml` by walking up from the current folder.
It works from the package folder where release-it runs.

To stamp a package other than the primary one, name it.

```shell
uvx repoplone deps stamp-volto-version --package @kitconcept/volto-intranet
```

```{seealso}
- {doc}`upgrade-plone-or-volto`, for the other base packages.
- {ref}`cli-deps-stamp-volto-version`, for the options of the command.
```
