cargo-publish-ordered

Crates.iocargo-publish-ordered
lib.rscargo-publish-ordered
version0.4.0
created_at2025-07-06 15:48:40.674604+00
updated_at2025-07-07 16:51:20.387253+00
descriptionA Cargo plugin to ensure that dependencies are published in a specific order, useful for projects with interdependent crates.
homepagehttps://houseme.github.io/cargo-publish-ordered/
repositoryhttps://github.com/houseme/cargo-publish-ordered
max_upload_size
id1740212
size67,999
houseme (houseme)

documentation

https://docs.rs/cargo-publish-ordered/latest/cargo_publish_ordered/

README

Cargo-Publish-Ordered

English|简体中文

A Cargo subcommand to publish packages in a Cargo workspace in topological order.

This tool is useful when you have local path dependencies in your workspace. It ensures that dependencies are published before the packages that depend on them, avoiding publishing failures due to missing dependency versions.

Features

  • Automatic Workspace Parsing: Automatically reads Cargo.toml and parses all packages within the workspace.
  • Dependency Graph Construction: Builds a directed acyclic graph (DAG) based on the path dependencies between packages.
  • Topological Sorting: Calculates the correct publishing order, ensuring dependencies are always published before the packages that depend on them.
  • Safe Dry Run: Provides a --dry-run flag to preview the publishing commands and order without actually publishing to crates.io.
  • Flexible Registry Support: Allows specifying a target registry via the --registry flag, defaulting to crates-io to avoid local configuration issues.
  • Actual Publishing: After verifying the order, it executes cargo publish commands to publish all packages.

Installation

Once the project is published to crates.io, you can install it with:

cargo install cargo-publish-ordered

Alternatively, you can install from source:

git clone https://github.com/houseme/cargo-publish-ordered.git
cd cargo-publish-ordered
cargo install --path .

Usage

Navigate to your Cargo workspace root directory.

Dry Run

It is recommended to perform a dry run first to check the publishing order and the commands that will be executed:

cargo publish-ordered --dry-run

Publishing

After confirming the order is correct, execute the publish command. You may need to provide a crates.io token. By default, this tool publishes to crates-io.

cargo publish-ordered --token ${CRATES_IO_TOKEN}

Publishing to a different registry

If you want to publish to an alternative registry (e.g., a private one), use the --registry flag:

cargo publish-ordered --token ${MY_REGISTRY_TOKEN} --registry my-private-registry

Contributing

Contributions of any kind are welcome! If you find a bug or have a feature suggestion, please feel free to create an Issue. If you want to contribute code, please fork the repository and submit a Pull Request.

License

This project is dual-licensed under Apache-2.0 licenses.

Commit count: 0

cargo fmt