Publishing
Battery packs are published to crates.io like any other Rust crate. A few things to keep in mind to make yours discoverable and useful.
Keywords
Include battery-pack as a keyword in your Cargo.toml so cargo bp list
can find it:
[package]
name = "error-battery-pack"
keywords = ["battery-pack", "error-handling", "anyhow", "thiserror"]
The battery-pack keyword is what cargo bp uses to discover packs on crates.io.
Add other keywords relevant to your domain.
Naming
Battery packs conventionally end in -battery-pack:
error-battery-packcli-battery-packasync-battery-packweb-battery-pack
The cargo bp CLI resolves short names automatically — cargo bp add cli
looks up cli-battery-pack. If you name your crate my-cool-battery-pack,
users can just type cargo bp add my-cool.
Versioning
Follow semver, but think about what constitutes a breaking change for a battery pack:
- Patch — updating a crate's patch version, fixing docs or examples
- Minor — adding new crates, adding new features (groups), adding new templates
- Major — removing crates, bumping a crate's major version, removing features
When you bump a curated crate's version, users will see a warning in
cargo bp status if their installed version is older. They can update
with cargo bp sync.
Pre-publish checklist
- README.md describes the battery pack clearly
- Examples are runnable (
cargo test --examples) - Templates work (
cargo bp new your-packfrom a temp directory) - Keywords include
battery-pack - License files are present (MIT and/or Apache-2.0 are conventional)
- Repository URL is set (for linking to examples and templates in the TUI)
Publishing
cargo publish
After publishing, your battery pack will appear in cargo bp list
within a few minutes (once the crates.io index updates).