https://github.com/sharksforarms/cargo-workspace-deps
consolidate cargo workspace dependencies
https://github.com/sharksforarms/cargo-workspace-deps
cargo cargo-subcommand
Last synced: 5 months ago
JSON representation
consolidate cargo workspace dependencies
- Host: GitHub
- URL: https://github.com/sharksforarms/cargo-workspace-deps
- Owner: sharksforarms
- License: apache-2.0
- Created: 2025-12-29T03:44:25.000Z (5 months ago)
- Default Branch: main
- Last Pushed: 2026-01-03T01:38:38.000Z (5 months ago)
- Last Synced: 2026-01-13T19:39:25.260Z (5 months ago)
- Topics: cargo, cargo-subcommand
- Language: Rust
- Homepage: https://crates.io/crates/cargo-workspace-deps
- Size: 57.6 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Funding: .github/FUNDING.yml
- License: LICENSE-APACHE
Awesome Lists containing this project
README
# cargo-workspace-deps
[](https://crates.io/crates/cargo-workspace-deps)
A Cargo subcommand that consolidates shared dependencies across workspace members into `[workspace.dependencies]`.
## What it does
Moves common dependencies to the workspace-level `[workspace.dependencies]` section and updates member crates to use `workspace = true`.
This reduces duplication and ensures version consistency across your Cargo workspace.
## Installation
### `cargo install` ([crates.io](https://crates.io/crates/cargo-workspace-deps))
```
cargo install cargo-workspace-deps --locked
```
### `cargo install` ([`main`](https://github.com/sharksforarms/cargo-workspace-deps/tree/main))
```
cargo install --git https://github.com/sharksforarms/cargo-workspace-deps --locked
```
## Examples
```bash
# Interactive mode (prompts for confirmation)
cargo workspace-deps
# Automatically apply changes
cargo workspace-deps --fix
# Check only, useful for CI
cargo workspace-deps --check
# Only consolidate dependencies used by 3+ members (default is 2)
cargo workspace-deps --min-members 3
# Skip specific dependencies
cargo workspace-deps --exclude "serde,tokio" --exclude-members "submodules/*"
```
## Usage
```bash
$ cargo workspace-deps --help
Moves shared dependencies to [workspace.dependencies] and updates members to use workspace = true.
Reduces duplication and ensures version consistency across the workspace.
Usage: cargo workspace-deps [OPTIONS]
Options:
--fix
Apply changes without prompting for confirmation
--check
Check mode: exit with error if changes needed (useful for CI)
--manifest-path
Path to workspace directory (defaults to current directory)
--no-dependencies
Skip processing [dependencies] section
--no-dev-dependencies
Skip processing [dev-dependencies] section
--no-build-dependencies
Skip processing [build-dependencies] section
--exclude
Skip specific dependencies by name (comma-separated, e.g. serde,tokio)
--exclude-members
Skip workspace members by glob pattern (comma-separated, e.g. submodules/*,deps/*)
--min-members
Only consolidate dependencies appearing in at least N members
[default: 2]
--version-resolution
Strategy for resolving version conflicts
Possible values:
- skip: Skip dependencies with conflicting versions
- highest: Use the highest version
- highest-compatible: Use the highest SemVer-compatible version
- lowest: Use the lowest version
- fail: Fail on version conflicts
[default: highest-compatible]
--format
Output format
[default: text]
[possible values: text, json]
-h, --help
Print help (see a summary with '-h')
-V, --version
Print version
```
## Limitations
Path dependencies (`path = "..."`), git dependencies (`git = "..."`), and platform-specific dependencies (`[target.'cfg(...)'.dependencies]`) are currently not supported and will be automatically skipped.