cargo-consolidate

Crates.iocargo-consolidate
lib.rscargo-consolidate
version0.1.0
sourcesrc
created_at2024-11-01 14:37:07.829628
updated_at2024-11-01 14:37:07.829628
descriptionA command-line tool to consolidate dependencies in a Rust workspace.
homepagehttps://github.com/gruberb/cargo-consolidate
repositoryhttps://github.com/gruberb/cargo-consolidate
max_upload_size
id1431877
size59,362
Bastian Gruber (gruberb)

documentation

https://docs.rs/cargo-consolidate

README

cargo-consolidate

The cargo-consolidate is a CLI to easier manage workspace dependencies. It scans all workspace members and checks, depending on the arguments passed, if a dependency is shared across at least two members. If so, it moves it up to the workspace Cargo.toml file.

Warning: There is no path resolution yet. So you most probably have to double check manually.

This is very much a WIP and a first shot in saving a 30 minutes of trying to manually combine workspace dependencies.

> cargo-consolidate --help
Usage: cargo-consolidate [OPTIONS]

Options:
      --manifest-path <MANIFEST_PATH>  Path to the workspace root Cargo.toml of the project you want to consolidate
      --group-all                      Group dependencies of all members into workspace.dependencies If set to false, just dependencies which are used by 2 or more members are being grouped into workspace.dependencies
  -v, --verbose...                     Increase output verbosity (can be used multiple times)
  -h, --help                           Print help

Installation

You can install cargo-consolidate directly from crates.io:

cargo install cargo-consolidate

Usage

cargo-consolidate --manifest-path /path/to/your/workspace/Cargo.toml

By default, a dependency has to occour at least twice to move it up to the project Cargo.toml. If you want to move EVERY dependency up, use the --group-all flag:

cargo-consolidate --manifest-path /path/to/your/workspace/Cargo.toml --group-all
Commit count: 6

cargo fmt