{"id":13566361,"url":"https://github.com/pksunkara/cargo-workspaces","last_synced_at":"2025-05-15T18:03:32.936Z","repository":{"id":38425777,"uuid":"254341694","full_name":"pksunkara/cargo-workspaces","owner":"pksunkara","description":"A tool for managing cargo workspaces and their crates, inspired by lerna","archived":false,"fork":false,"pushed_at":"2024-01-24T13:20:16.000Z","size":313,"stargazers_count":440,"open_issues_count":22,"forks_count":42,"subscribers_count":6,"default_branch":"master","last_synced_at":"2024-04-14T09:10:20.665Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pksunkara.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-04-09T10:33:46.000Z","updated_at":"2024-05-29T01:35:22.767Z","dependencies_parsed_at":"2024-01-03T03:45:59.049Z","dependency_job_id":"9b977c7c-f995-4cd3-8271-f848f4acdf10","html_url":"https://github.com/pksunkara/cargo-workspaces","commit_stats":{"total_commits":179,"total_committers":16,"mean_commits":11.1875,"dds":"0.15642458100558654","last_synced_commit":"fc3026016b2fade2d5ecdef470ba641bc1492bf6"},"previous_names":[],"tags_count":59,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pksunkara%2Fcargo-workspaces","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pksunkara%2Fcargo-workspaces/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pksunkara%2Fcargo-workspaces/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pksunkara%2Fcargo-workspaces/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pksunkara","download_url":"https://codeload.github.com/pksunkara/cargo-workspaces/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247744333,"owners_count":20988783,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-01T13:02:07.963Z","updated_at":"2025-05-15T18:03:32.917Z","avatar_url":"https://github.com/pksunkara.png","language":"Rust","funding_links":[],"categories":["Rust","Cargo Subcommands"],"sub_categories":[],"readme":"\u003c!-- omit from toc --\u003e\n# cargo-workspaces\n\nInspired by [Lerna](https://lerna.js.org/)\n\nA tool that optimizes the workflow around cargo workspaces with `git` and `cargo` by providing utilities to\nversion, publish, execute commands and more.\n\nI made this to work on [clap](https://github.com/clap-rs/clap) and other projects that rely on workspaces.\nBut this will also work on single crates because by default every individual crate is a workspace.\n\n1. [Installation](#installation)\n2. [Usage](#usage)\n   1. [Init](#init)\n   2. [Create](#create)\n   3. [List](#list)\n   4. [Changed](#changed)\n   5. [Exec](#exec)\n   6. [Version](#version)\n      1. [Fixed or Independent](#fixed-or-independent)\n   7. [Publish](#publish)\n   8. [Rename](#rename)\n   9. [Plan](#plan)\n3. [Config](#config)\n4. [Changelog](#changelog)\n\n## Installation\n\n```\ncargo install cargo-workspaces\n```\n\n## Usage\n\nThe installed tool can be called by `cargo workspaces` or `cargo ws`. Both of them point to the same.\n\nYou can use `cargo ws help` or `cargo ws help \u003csubcmd\u003e` anytime to understand allowed options.\n\nThe basic commands available for this tool are given below. Assuming you run them inside a cargo workspace.\n\n### Init\n\nInitializes a new cargo workspace in the given directory. Creates `Cargo.toml` if it does not exist and\nfills the `members` with the all the crates that can be found in that directory.\n\n```\nUSAGE:\n    cargo workspaces init [PATH]\n\nARGS:\n    \u003cPATH\u003e    Path to the workspace root [default: .]\n\nOPTIONS:\n    -h, --help    Print help information\n```\n\n### Create\n\nInteractively creates a new crate in the workspace. *We recommend using this instead of `cargo new`*. All\nthe crates start with `0.0.0` version because the [version](#version) is responsible for determining the\nversion.\n\n```\nUSAGE:\n    cargo workspaces create [OPTIONS] \u003cPATH\u003e\n\nARGS:\n    \u003cPATH\u003e    Path for the crate relative to the workspace manifest\n\nOPTIONS:\n        --bin                  Whether this is a binary crate\n        --edition \u003cEDITION\u003e    The crate edition [possible values: 2015, 2018, 2021]\n    -h, --help                 Print help information\n        --lib                  Whether this is a library crate\n        --name \u003cNAME\u003e          The name of the crate\n```\n\n### List\n\nLists crates in the workspace.\n\n```\nUSAGE:\n    cargo workspaces list [OPTIONS]\n\nOPTIONS:\n    -h, --help    Print help information\n\nLIST OPTIONS:\n    -a, --all     Show private crates that are normally hidden\n        --json    Show information as a JSON array\n    -l, --long    Show extended information\n```\n\nSeveral aliases are available.\n\n* `cargo ws ls` implies `cargo ws list`\n* `cargo ws ll` implies `cargo ws list --long`\n* `cargo ws la` implies `cargo ws list --all`\n\n### Changed\n\nList crates that have changed since the last git tag. This is useful to see the list of crates that\nwould be the subjects of the next [version](#version) or [publish](#publish) command.\n\n```\nUSAGE:\n    cargo workspaces changed [OPTIONS]\n\nOPTIONS:\n        --error-on-empty              Return non-zero exit code if no changes detected\n        --force \u003cpattern\u003e             Always include targeted crates matched by glob even when there are no changes\n    -h, --help                        Print help information\n        --ignore-changes \u003cpattern\u003e    Ignore changes in files matched by glob\n        --include-merged-tags         Include tags from merged branches\n        --since \u003cSINCE\u003e               Use this git reference instead of the last tag\n\nLIST OPTIONS:\n    -a, --all     Show private crates that are normally hidden\n        --json    Show information as a JSON array\n    -l, --long    Show extended information\n```\n\n### Exec\n\nExecutes an arbitrary command in each crate of the workspace.\n\n```\nUSAGE:\n    cargo workspaces exec [OPTIONS] \u003cARGS\u003e...\n\nARGS:\n    \u003cARGS\u003e...\n\nOPTIONS:\n    -h, --help                Print help information\n        --ignore \u003cpattern\u003e    Ignore the crates matched by glob\n        --ignore-private      Ignore private crates\n        --no-bail             Continue executing command despite non-zero exit in a given crate\n```\n\nFor example, if you want to run `ls -l` in each crate, you can simply do `cargo ws exec ls -l`.\n\n### Version\n\nBump versions of the crates in the workspace. This command does the following:\n\n1. Identifies crates that have been updated since the previous tagged release\n2. Prompts for a new version according to the crate\n3. Modifies crate manifest to reflect new release\n4. Update intra-workspace dependency version constraints if needed\n5. Commits those changes\n6. Tags the commit\n7. Pushes to the git remote\n\nYou can influence the above steps with the flags and options for this command.\n\n```\nUSAGE:\n    cargo workspaces version [OPTIONS] [ARGS]\n\nOPTIONS:\n    -h, --help    Print help information\n\nVERSION ARGS:\n    \u003cBUMP\u003e      Increment all versions by the given explicit semver keyword while skipping the prompts for them\n                [possible values: major, minor, patch, premajor, preminor, prepatch, skip, prerelease, custom]\n    \u003cCUSTOM\u003e    Specify custom version value when 'bump' is set to 'custom'\n\nVERSION OPTIONS:\n    -a, --all                         Also do versioning for private crates (will not be published)\n        --exact                       Specify inter dependency version numbers exactly with `=`\n        --force \u003cpattern\u003e             Always include targeted crates matched by glob even when there are no changes\n        --ignore-changes \u003cpattern\u003e    Ignore changes in files matched by glob\n        --include-merged-tags         Include tags from merged branches\n        --pre-id \u003cidentifier\u003e         Specify prerelease identifier\n    -y, --yes                         Skip confirmation prompt\n\nGIT OPTIONS:\n        --allow-branch \u003cpattern\u003e            Specify which branches to allow from [default: master]\n        --amend                             Amend the existing commit, instead of generating a new one\n        --git-remote \u003cremote\u003e               Push git changes to the specified remote [default: origin]\n        --individual-tag-prefix \u003cprefix\u003e    Customize prefix for individual tags (should contain `%n`) [default: %n@]\n    -m, --message \u003cMESSAGE\u003e                 Use a custom commit message when creating the version commit [default: Release %v]\n        --no-git-commit                     Do not commit version changes\n        --no-git-push                       Do not push generated commit and tags to git remote\n        --no-git-tag                        Do not tag generated commit\n        --no-global-tag                     Do not create a global tag for a workspace\n        --no-individual-tags                Do not tag individual versions for crates\n        --tag-prefix \u003cprefix\u003e               Customize tag prefix (can be empty) [default: v]\n```\n\n#### Fixed or Independent\n\nBy default, all the crates in the workspace will share a single version. But if you want the crate to have\nit's version be independent of the other crates, you can add the following to that crate:\n\n```toml\n[package.metadata.workspaces]\nindependent = true\n```\n\nFor more details, check [Config](#config) section below.\n\n### Publish\n\nPublish all the crates from the workspace in the correct order according to the dependencies. By default,\nthis command runs [version](#version) first. If you do not want that to happen, you can supply the\n`--from-git` option.\n\n\u003e Note: dev-dependencies are not taken into account when building the dependency\n\u003e graph used to determine the proper publishing order. This is because\n\u003e dev-dependencies are ignored by `cargo publish` - as such, a dev-dependency on a\n\u003e local crate (with a `path` attribute), should _not_ have a `version` field.\n\n```\nUSAGE:\n    cargo workspaces publish [OPTIONS] [ARGS]\n\nOPTIONS:\n    -h, --help    Print help information\n\nVERSION ARGS:\n    \u003cBUMP\u003e      Increment all versions by the given explicit semver keyword while skipping the prompts for them\n                [possible values: major, minor, patch, premajor, preminor, prepatch, skip, prerelease, custom]\n    \u003cCUSTOM\u003e    Specify custom version value when 'bump' is set to 'custom'\n\nVERSION OPTIONS:\n    -a, --all                         Also do versioning for private crates (will not be published)\n        --exact                       Specify inter dependency version numbers exactly with `=`\n        --force \u003cpattern\u003e             Always include targeted crates matched by glob even when there are no changes\n        --ignore-changes \u003cpattern\u003e    Ignore changes in files matched by glob\n        --include-merged-tags         Include tags from merged branches\n        --pre-id \u003cidentifier\u003e         Specify prerelease identifier\n    -y, --yes                         Skip confirmation prompt\n\nGIT OPTIONS:\n        --allow-branch \u003cpattern\u003e            Specify which branches to allow from [default: master]\n        --amend                             Amend the existing commit, instead of generating a new one\n        --git-remote \u003cremote\u003e               Push git changes to the specified remote [default: origin]\n        --individual-tag-prefix \u003cprefix\u003e    Customize prefix for individual tags (should contain `%n`) [default: %n@]\n    -m, --message \u003cMESSAGE\u003e                 Use a custom commit message when creating the version commit [default: Release %v]\n        --no-git-commit                     Do not commit version changes\n        --no-git-push                       Do not push generated commit and tags to git remote\n        --no-git-tag                        Do not tag generated commit\n        --no-global-tag                     Do not create a global tag for a workspace\n        --no-individual-tags                Do not tag individual versions for crates\n        --tag-prefix \u003cprefix\u003e               Customize tag prefix (can be empty) [default: v]\n\nPUBLISH OPTIONS:\n        --allow-dirty           Allow dirty working directories to be published\n        --dry-run               Runs in dry-run mode\n        --locked                Assert that `Cargo.lock` will remain unchanged\n        --no-remove-dev-deps    Don't remove dev-dependencies while publishing\n        --no-verify             Skip crate verification (not recommended)\n        --publish-as-is         Publish crates from the current commit without versioning\n\nREGISTRY OPTIONS:\n        --registry \u003cREGISTRY\u003e    The Cargo registry to use\n        --token \u003cTOKEN\u003e          The token to use for accessing the registry\n```\n\n### Rename\n\nRename crates in the project. You can run this command when you might want to publish the crates with a standard prefix.\n\n```\nUSAGE:\n    cargo workspaces rename [OPTIONS] \u003cTO\u003e\n\nARGS:\n    \u003cTO\u003e    The value that should be used as new name (should contain `%n`)\n\nOPTIONS:\n    -a, --all                 Rename private crates too\n    -f, --from \u003ccrate\u003e        Rename only a specific crate\n    -h, --help                Print help information\n        --ignore \u003cpattern\u003e    Ignore the crates matched by glob\n```\n\n### Plan\n\nList the crates in publishing order. This does not check for changes or try to version. It takes the crates as-is.\n\n```\nUSAGE:\n    cargo workspaces plan [OPTIONS]\n\nOPTIONS:\n    -h, --help              Print help information\n        --skip-published    Skip already published crate versions\n\nREGISTRY OPTIONS:\n        --registry \u003cREGISTRY\u003e    The Cargo registry to use\n        --token \u003cTOKEN\u003e          The token to use for accessing the registry\n\nLIST OPTIONS:\n        --json    Show information as a JSON array\n    -l, --long    Show extended information\n```\n\n## Config\n\nThere are two kind of options.\n\n* **Workspace**: Options that are specified in the workspace with `[workspace.metadata.workspaces]`\n* **Package**: Options that are specified in the package with `[package.metadata.workspaces]`\n\nIf an option is allowed to exist in both places, it means that the value specified in the **Package**\noverrides the value specified in **Workspace**.\n\n| Name | Type | Workspace | Package | Used in Commands |\n| --- | --- | :---: | :---: | --- |\n| `allow_branch` | `String` | Yes | No | `version`, `publish` |\n| `independent` | `bool` | No | Yes | `version`, `publish` |\n| `no_individual_tags` | `bool` | Yes | No | `version`, `publish` |\n\n\u003c!-- omit from toc --\u003e\n## Contributors\nHere is a list of [Contributors](http://github.com/pksunkara/cargo-workspaces/contributors)\n\n\u003c!-- omit from toc --\u003e\n### TODO\n\n## Changelog\nPlease see [CHANGELOG.md](CHANGELOG.md).\n\n\u003c!-- omit from toc --\u003e\n## License\nMIT/X11\n\n\u003c!-- omit from toc --\u003e\n## Bug Reports\nReport [here](http://github.com/pksunkara/cargo-workspaces/issues).\n\n\u003c!-- omit from toc --\u003e\n## Creator\nPavan Kumar Sunkara (pavan.sss1991@gmail.com)\n\nFollow me on [github](https://github.com/users/follow?target=pksunkara), [twitter](http://twitter.com/pksunkara)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpksunkara%2Fcargo-workspaces","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpksunkara%2Fcargo-workspaces","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpksunkara%2Fcargo-workspaces/lists"}