Skip to content

Updating dependencies

When you have multiple packages which depend on each other, you’ll likely want to keep those dependencies up to date.

For example, Knope depends on the knope-versioning crate. Whenever knope-versioning is updated, the new version should appear in:

  1. knope-versioning’s Cargo.toml, defining the new version of the package
  2. knope’s Cargo.toml, specifying the new version of knope-versioning as a dependency
  3. The workspace Cargo.lock, recording the exact version of knope-versioning used by the workspace

Before adding dependency updates, the relevant package config looks like this:

knope.toml
[packages.versioning]
versioned_files = ["crates/knope-versioning/Cargo.toml"]

The lock file can be added as a normal path. Because it has a specific file name, Knope knows what file type it is.

knope.toml
[packages.versioning]
versioned_files = ["crates/knope-versioning/Cargo.toml", "Cargo.lock"]

Knope will use the package.name field from the first Cargo.toml file to determine which package to update in Cargo.lock.

For the other Cargo.toml file, you must specify that a dependency within the file is what should be versioned, not the package itself:

knope.toml
[packages.versioning]
versioned_files = [
"crates/knope-versioning/Cargo.toml",
"Cargo.lock",
{ path = "crates/knope/Cargo.toml", dependency = "knope-versioning" },
]