#monorepo #publishing #cargo-workspace #cargo #unleash #workspace

app cargo-unleash

用于管理大规模工作空间/单体仓库中 crates 发布的工具

14 个版本

1.0.0-alpha.dev2022年2月1日
1.0.0-alpha.132021年11月10日
1.0.0-alpha.122021年5月18日
1.0.0-alpha.112021年1月5日
1.0.0-alpha.92020年2月28日

#342Cargo 插件

每月41次 下载

GPL-3.0 许可

110KB
2.5K SLoC

cargo unleash em 🐉

cargo release 自动化工具,用于 大规模单体仓库。主要用于 Parity Substrate

变更

查看 Changelog.md

安装

使用 cargo install 进行安装

cargo install cargo-unleash --version 1.0.0-alpha.13

用法

尝试报告它会在你的单体仓库中做什么


cargo unleash em-dragons --dry-run

CLI 中还有更多选项,只需运行 --help 即可

Release the crates of this massiv monorepo

USAGE:
    cargo-unleash [FLAGS] [OPTIONS] <SUBCOMMAND>

FLAGS:
    -h, --help
            Prints help information

    -V, --version
            Prints version information

    -v, --verbose
            Show verbose cargo output


OPTIONS:
    -l, --log <log>
            Specify the log levels [default: warn]

    -m, --manifest-path <manifest-path>
            The path to workspace manifest

            Can either be the folder if the file is named `Cargo.toml` or the path to the specific `.toml`-manifest to
            load as the cargo workspace. [default: ./]

SUBCOMMANDS:
    add-owner      Add owners for a lot of crates
    check          Check whether crates can be packaged
    clean-deps     Check the package(s) for unused dependencies
    de-dev-deps    Deactivate the `[dev-dependencies]`
    em-dragons     Unleash 'em dragons
    help           Prints this message or the help of the given subcommand(s)
    rename         Rename a package
    set            Set a field in all manifests
    to-release     Calculate the packages and the order in which to release
    version        Messing with versioning

em-dragons

主要命令是 cargo unleash em-dragons,以下是它的帮助信息。所有子命令都有详细的 --help 帮助信息。

$ cargo-unleash em-dragons --help
Unleash 'em dragons

Package all selected crates, check them and attempt to publish them.

USAGE:
    cargo-unleash em-dragons [FLAGS] [OPTIONS]

FLAGS:
        --build
            Actually build the package in check

            By default, this only runs `cargo check` against the package build. Set this flag to have it run an actual
            `build` instead.
        --check-readme
            Generate & verify whether the Readme file has changed.

            When enabled, this will generate a Readme file from the crate's doc comments (using cargo-readme), and check
            whether the existing Readme (if any) matches.
        --dry-run
            dry run

        --empty-is-failure
            Consider no package matching the criteria an error

    -h, --help
            Prints help information

        --ignore-publish
            Ignore whether `publish` is set.

            If nothing else is specified, `publish = true` is assumed for every package. If publish is set to false or
            any registry, it is ignored by default. If you want to include it regardless, set this flag.
        --include-dev-deps
            Do not disable dev-dependencies

            By default we disable dev-dependencies before the run.
        --include-pre-deps
            Even if not selected by default, also include depedencies with a pre (cascading)

        --no-check
            dry run

    -V, --version
            Prints version information


OPTIONS:
        --owner <add-owner>
            Ensure we have the owner set as well

    -c, --changed-since <changed-since>
            Automatically detect the packages, which changed compared to the given git commit.

            Compares the current git `head` to the reference given, identifies which files changed and attempts to
            identify the packages and its dependents through that mechanism. You can use any `tag`, `branch` or
            `commit`, but you must be sure it is available (and up to date) locally.
    -i, --ignore-pre-version <ignore-pre-version>...
            Ignore version pre-releases

            Skip if the SemVer pre-release field is any of the listed. Mutually exclusive with `--package`
    -p, --packages <packages>...
            Only use the specfic set of packages

            Apply only to the packages named as defined. This is mutually exclusive with skip and ignore-version-pre.
    -s, --skip <skip>...
            Skip the package names matching ...

            Provide one or many regular expression that, if the package name matches, means we skip that package.
            Mutually exclusive with `--package`
        --token <token>
            the crates.io token to use for uploading

            If this is nor the environment variable are set, this falls back to the default value provided in the user
            directory [env: CRATES_TOKEN]

常用示例

发布所有没有设置 -dev-pre 版本的 crates

cargo-unleash em-dragons --ignore-pre-version dev

检查 PR 是否可以发布(仅检查 PR 与 main 之间的更改)

cargo-unleash check --changed-since=main

发布所有没有 test 在名称中的 crates

cargo-unleash em-dragons --skip test

将预版本设置为 -dev

cargo-unleash version set-pre dev

提升预版本,例如从 alpha.1 提升到 alpha.2 或从 beta.3 提升到 beta.4

cargo-unleash version bump-pre

野外使用

您正在使用此工具并希望在此处被提及 - 创建一个问题

许可协议 & 致谢

本软件遵循 GNU 通用公共许可证 (GPL) 3.0 发布。

与其他软件一样,本软件也是在巨人的肩膀上构建的。特别是,它内部使用 cargo,并大量借鉴了 cargo publish-allcargo hack 建立的知识。

依赖项

~53MB
~1M SLoC