..

在crates.io上发布一个crate

当完成一个 crate 的时候, 就可以往 crates.io 上发布了。

Pre

  • 如果在 ~/.cargo/config 中设置了镜像的,修改过来,只能用 [source.crates-io]
  • cargo.toml 中引用的crate路径必须是 crates.io 上的
  • version 记得修改成最新的

完善 cargo.toml 文件。 参考 jlib-rs 项目如下

[package]
name = "jlib"
version = "0.4.0"
authors = ["zTgx <beautifularea@163.com>"]
repository = "https://github.com/zTgx/jlib-rs.git"
readme = "README.md"
keywords = ["blockchain", "crypto"]
categories = [ "cryptography" ]
license = "MIT/Apache-2.0"
exclude = [ "/.travis.yml" ]
description = "A lightweight blockchain lib."
edition = "2018"

[dependencies]
num = "0.2"
rand = "0.6"
ws = { version = "0.8.1", features = ["ssl"]}
void = "1.0.2"
ring = "0.14.6"
serde_json = "1.0"
typename = "0.1.1"
secp256k1 = "0.13.0"
rust-crypto = "^0.2"
lazy_static = "1.3.0"
ed25519-dalek = "0.9.1"
serde = { version = "1.0", features = ["derive"] }
basex-rs = "0.1.1"
serde_derive = "1.0"
phf = { version = "0.8", features = ["macros"] }
libsm = "0.3.0"
hex = "0.4.3"
rfc1751 = "0.1.0"

登录

cargo login xxxx

发布 1 2

cargo publish