Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Workspace inheritance breaks cargo readme #81

Open
leighmcculloch opened this issue Dec 2, 2022 · 5 comments
Open

Workspace inheritance breaks cargo readme #81

leighmcculloch opened this issue Dec 2, 2022 · 5 comments

Comments

@leighmcculloch
Copy link

leighmcculloch commented Dec 2, 2022

Projects that use workspace inheritance, such as to replace a version in a crate toml with version.workspace = true cause cargo readme to error with:

Error: invalid type: map, expected a string for key `package.version` at line 9 column 21

Details about workspace inheritance: https://doc.rust-lang.org/cargo/reference/workspaces.html

@robertbastian
Copy link

Consider using the cargo_toml crate to parse Cargo.toml instead of doing it yourself

@yassun7010
Copy link

Any progress on this Issue?

I am very interested in this issue.

@alexspa
Copy link

alexspa commented Jan 19, 2024

I experience similar problems receiving following errors:

$cargo readme
Error: TOML parse error at line 1, column 1
  |
1 | [package]
  | ^^^^^^^^^^
invalid type: map, expected a string
$cargo readme
Error: TOML parse error at line 1, column 1
  |
1 | [workspace]
  | ^
missing field `package``

@joshlf
Copy link

joshlf commented Oct 12, 2024

Chiming in as someone broken by this: google/zerocopy#1884

@schneems
Copy link

schneems commented Oct 28, 2024

Same. Inputs:

$ cat cargo.toml
[workspace]
resolver = "2"
members = [
    "usage",
    "cache_diff",
    "cache_diff_derive",
]

[workspace.package]
version = "0.1.0"
rust-version = "1.82"
edition = "2021"
license = "BSD-3-Clause"
repository = "https://github.com/schneems/cache_diff"
documentation = "https://docs.rs/cache_diff"
⛄️ 3.3.1 🚀 /Users/rschneeman/Documents/projects/cache_diff (main)
$ cat cache_diff/cargo.toml
[package]
name = "cache_diff"
description = "Generate clean, human readable diffs between two cache structs"
include = ["src/**/*", "LICENSE.md", "README.md"]
version.workspace = true
edition.workspace = true
rust-version.workspace = true
license.workspace = true
repository.workspace = true
documentation.workspace = true

[dependencies]
cache_diff_derive = { version = "0", optional = true, path = "../cache_diff_derive" }
bullet_stream = { version = "0", optional = true }

[features]
default = ["derive"]
derive = ["dep:cache_diff_derive"]

# Formats values with `bullet_stream::style::value` which includes ANSI colors
bullet_stream = ["derive", "dep:bullet_stream"]

Output:

$ cargo readme --project-root cache_diff > cache_diff/README.md
Error: TOML parse error at line 5, column 1
  |
5 | version.workspace = true
  | ^^^^^^^
invalid type: map, expected a string

You can reproduce with schneems/cache_diff@fff7363

Edit: https://crates.io/crates/cargo-rdme works with this workspace

schneems added a commit to schneems/cache_diff that referenced this issue Oct 28, 2024
The cargo-readme crate does not work with workspaces:

webern/cargo-readme#81

The cargo-rdme project seems to handle workspaces with no problems.
schneems added a commit to schneems/cache_diff that referenced this issue Oct 28, 2024
* Add bullet stream formatting

* Add docs

* Switch to cargo-rdme

The cargo-readme crate does not work with workspaces:

webern/cargo-readme#81

The cargo-rdme project seems to handle workspaces with no problems.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants